-
Notifications
You must be signed in to change notification settings - Fork 171
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
Scoped variables show destructured parameters. #4882
Merged
Merged
Conversation
This file contains 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
- Added `propertiesExposedByParam` utility function. - Added `findContainingComponent` utility function. - `getVariablesInScope` now finds the correct component and not just the first one. - Fixed `applyPropsParamToPassedProps` to correctly handle destructured values and repeated field usages. - `createComponentRendererComponent` includes values exposed by the props param when building `spiedVariablesInScope`.
seanparsons
requested review from
gbalint,
Rheeseyb,
ruggi,
balazsbajorics,
liady and
bkrmendy
February 12, 2024 22:03
Job #10393: Bundle Size — 61.74MiB (~+0.01%).
Warning Bundle contains 57 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
View job #10393 report View feature/scoped-nested-parameters branch activity View project dashboard |
editor/src/components/canvas/ui-jsx-canvas-renderer/ui-jsx-canvas-component-renderer.tsx
Show resolved
Hide resolved
editor/src/components/canvas/ui-jsx-canvas-renderer/ui-jsx-canvas-props-utils.ts
Show resolved
Hide resolved
balazsbajorics
approved these changes
Feb 13, 2024
Rheeseyb
reviewed
Feb 13, 2024
editor/src/components/canvas/ui-jsx-canvas-renderer/ui-jsx-canvas-component-renderer.tsx
Outdated
Show resolved
Hide resolved
Rheeseyb
approved these changes
Feb 13, 2024
liady
approved these changes
Feb 13, 2024
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.
Problem:
With code like the following in a component:
The destructured values aren't made available into the scoped variables menu.
Fix:
The main fixes needed for this to work were the following:
createComponentRendererComponent
now usespropertiesExposedByParam
to identify the properties that are brought into scope from the destructuring, which are added to the dictionary of scoped variables.applyPropsParamToPassedProps
wasn't properly handled destructured fields that are renamed.In the process of doing the above work I noticed that
getVariablesInScope
was looking for the first component it could find, not the targeted component. To perform the lookupfindContainingComponent
was implemented.Commit Details:
propertiesExposedByParam
utility function.findContainingComponent
utility function.getVariablesInScope
now finds the correct component and not just the first one.applyPropsParamToPassedProps
to correctly handle destructured values and repeated field usages.createComponentRendererComponent
includes values exposed by the props param when buildingspiedVariablesInScope
.