fix(content-docs): add trailing slash to contentDirs, before passing it to isMDXPartial #8275
+5
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pre-flight checklist
Motivation
If you have multi-instances and versioning and you're trying to import partial MDX to a file from cut version, you'll get console error. This happens because a paths to the directory with the next version docs and directory with docs for some version starts with the same, i.e "**/instance" and "**/instance_versioned_docs/**". So, isMDXPartial() uses wrong directory as a root directory as a root. We need to append slashes to contentDirs, so that "**/instance/**"(slash added) will not mix up with "**/instance_versioned_docs/**"
Example:
In my docs folder I have a folder "_includes" with MDX partials. I use multi-instances, "instance" is a name of one of the instances. I import partials like that:
import Partial from '@site/instance/_includes/_partial.mdx';
Then I cut a new version and want to update the imports to "versioned_docs" path, so I use:
import Partial from '@site/instance_versioned_docs/version-1.0.0/_includes/_partial.mdx';
The same thing when I use relative paths.