-
Notifications
You must be signed in to change notification settings - Fork 561
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
fix: identifiers are not incorrectly scoped to state #1630
Conversation
🦋 Changeset detectedLatest commit: 6a0fc6b The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 6a0fc6b. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution ✅ Successfully ran 4 targetsSent with 💌 from NxCloud. |
.changeset/late-papayas-eat.md
Outdated
'@builder.io/mitosis': patch | ||
--- | ||
|
||
identifiers are not incorrectly scoped to state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we follow the changeset format here? what exactly got fixed, for which generators/parsers, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated in ed6b5f8
Let me know if you have other ideas for how to word this
.changeset/late-papayas-eat.md
Outdated
'@builder.io/mitosis': patch | ||
--- | ||
|
||
shadowed variables in state methods are not scoped to state in all generators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[All] Fix: scope renaming of state methods to not include shadow variables
[Angular]: Update state.*
-> this.*
transform to new AST transform approach
Description
https://builder-io.atlassian.net/browse/ENG-7338
Mitosis transforms identifiers that have the same name as state variables to have
this.
orstate.
prefixed where necessary. This causes issues with shadowed variables that are unrelated to state.In the following example, the
errors
infoo
have nothing to do with theerrors
defined in state.However, this is incorrectly prefixed with
state.
which causes runtime issues:This transformation is only needed when moving functions into state or when using
useState
. To fix this, I updated Mitosis to only transform state values that were set usinguseState
or were function that got moved to state.Make sure to follow the PR preparation steps in CONTRIBUTING.md before submitting your PR:
yarn fmt:prettier
.yarn test:update
yarn g:changeset
and follow the CLI instructions. Alternatively, use the Changeset Github Bot to create the file.