-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data Picker: be able to pick global variables (#5790)
**Problem:** Globally declared variables were missing from the data picker. To investigate, I created a sample project with nested scopes and I've identified two missing cases, the first one is: globally declared variables in the code file. I had to re-acquaint myself with the render-core-element codebase, and with @seanparsons 's help I realized what we are missing was `runBlockUpdatingScope` returning spied variables. **Fix:** The solution was to extend the file-scope-level `mutableContext` and add a new field `spiedVariablesDeclaredInRootScope: VariableData` in there. **Commit Details:** - Added a new FileRootPath type so it's now `insertionCeiling: FileRootPath | ElementPath`, this lets us not use `null` or `EP.emptyPath` as the "file root" reference - New easier-to-read test case in `scoped-variables.spec.tsx` - runBlockUpdatingScope returns `spiedVariablesDeclaredWithinBlock: VariableData` - feed spiedVariablesDeclaredWithinBlock into `mutableContext.spiedVariablesDeclaredInRootScope` - extend `spiedVariablesInScope` in `createComponentRendererComponent` to include the root scope variables **Manual Tests:** I hereby swear that: - [x] I opened a hydrogen project and it loaded - [x] I could navigate to various routes in Preview mode
- Loading branch information
1 parent
febab34
commit 47ac149
Showing
21 changed files
with
401 additions
and
86 deletions.
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.