Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly handle JSX tags in order #486

Merged
merged 1 commit into from
Dec 23, 2024
Merged

Conversation

remcohaszing
Copy link
Member

Initial checklist

  • I read the support docs
  • I read the contributing guide
  • I agree to follow the code of conduct
  • I searched issues and discussions and couldn’t find anything or linked relevant results below
  • I made sure the docs are up to date
  • I included tests (or that’s not needed)

Description of changes

Virtual code generation from estree expressions was based on an assumption of the order in which JSXIdentifier nodes are visited. estree-walker visits the nodes in property order. The parser generates AST properties in an order that broke our code generation. As a result, the string _components. was injected in an incorrect position in the virtual code, yielding syntax errors.

This is now resolved by explicitly handling JSXElement nodes in both the enter and leave methods, instead of just handling JSXIdentifier nodes.

Closes #485

Virtual code generation from estree expressions was based on an
assumption of the order in which JSXIdentifier nodes are visited.
`estree-walker` visits the nodes in property order. The parser generates
AST properties in an order that broke our code generation. As a result,
the string `_components.` was injected in an incorrect position in the
virtual code, yielding syntax errors.

This is now resolved by explicitly handling `JSXElement` nodes in both
the enter and leave methods, instead of just handling `JSXIdentifier`
nodes.

Closes #485
Copy link

changeset-bot bot commented Dec 22, 2024

🦋 Changeset detected

Latest commit: 4c049d1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@mdx-js/language-service Patch
@mdx-js/language-server Patch
@mdx-js/typescript-plugin Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added 👋 phase/new Post is being triaged automatically 🤞 phase/open Post is being triaged manually and removed 👋 phase/new Post is being triaged automatically labels Dec 22, 2024
@remcohaszing remcohaszing added 🐛 type/bug This is a problem 🗄 area/interface This affects the public interface 🙆 yes/confirmed This is confirmed and ready to be worked on 👍 phase/yes Post is accepted and can be worked on labels Dec 22, 2024
@github-actions github-actions bot removed the 🤞 phase/open Post is being triaged manually label Dec 22, 2024

This comment has been minimized.

@remcohaszing remcohaszing merged commit b2e9706 into main Dec 23, 2024
13 checks passed
@remcohaszing remcohaszing deleted the explicit-jsx-tag-order branch December 23, 2024 10:09

This comment has been minimized.

@github-actions github-actions bot mentioned this pull request Dec 22, 2024
@remcohaszing remcohaszing added the 💪 phase/solved Post is done label Dec 23, 2024
@github-actions github-actions bot removed 👍 phase/yes Post is accepted and can be worked on 🙆 yes/confirmed This is confirmed and ready to be worked on labels Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🗄 area/interface This affects the public interface 💪 phase/solved Post is done 🐛 type/bug This is a problem
Development

Successfully merging this pull request may close these issues.

Function as Child Component
1 participant