fix(content-docs): add trailing slash to contentDirs, before passing it to isMDXPartial#8275
Merged
slorber merged 1 commit intofacebook:mainfrom Nov 23, 2022
Conversation
…it to isMDXPartial
✅ [V2]Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site settings. |
⚡️ Lighthouse report for the deploy preview of this PR
|
slorber
approved these changes
Nov 2, 2022
Contributor
Author
|
@slorber Hi, could you please help with merging this? Windows Tests failed due to timeout, maybe we can just re-run them? Thanks |
Collaborator
|
Sorry, I just forgot to merge ;) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.