-
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
Handle Changing Imports In Canvas #6567
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 `getProjectImports` utility function. - In `UiJsxCanvas` check the project imports as an additional case to `shouldRerenderRef`.
#14903 Bundle Size — 57.97MiB (~+0.01%).112d15b(current) vs 916e8b9 master#14901(baseline) Warning Bundle contains 70 duplicate packages – View duplicate packages Bundle metrics
|
Current #14903 |
Baseline #14901 |
|
---|---|---|
Initial JS | 40.96MiB (~+0.01% ) |
40.96MiB |
Initial CSS | 0B |
0B |
Cache Invalidation | 18.51% |
0% |
Chunks | 20 |
20 |
Assets | 22 |
22 |
Modules | 4152 |
4152 |
Duplicate Modules | 213 |
213 |
Duplicate Code | 27.34% |
27.34% |
Packages | 477 |
477 |
Duplicate Packages | 70 |
70 |
Bundle size by type 2 changes
1 regression
1 improvement
Current #14903 |
Baseline #14901 |
|
---|---|---|
JS | 57.97MiB (~+0.01% ) |
57.97MiB |
HTML | 7.37KiB (-0.25% ) |
7.39KiB |
Bundle analysis report Branch fix/handle-changing-imports-in-c... Project dashboard
Generated by RelativeCI Documentation Report issue
- Implemented `projectContentsSameForRefreshRequire`. - Changed out old `haveProjectImportsChanged` call to use the new `projectContentsSameForRefreshRequire`.
seanparsons
requested review from
Rheeseyb,
ruggi,
balazsbajorics and
bkrmendy
October 22, 2024 12:28
Rheeseyb
reviewed
Oct 22, 2024
editor/src/components/canvas/canvas-strategies/strategies/grid-draw-to-insert-strategy.tsx
Show resolved
Hide resolved
Rheeseyb
reviewed
Oct 22, 2024
Rheeseyb
reviewed
Oct 22, 2024
Rheeseyb
reviewed
Oct 22, 2024
Rheeseyb
approved these changes
Oct 22, 2024
- Speed improvement to `projectContentsSameForRefreshRequire`. - Remove unused code.
ruggi
approved these changes
Oct 22, 2024
liady
pushed a commit
that referenced
this pull request
Dec 13, 2024
- Removed the previous handling of `shouldRerenderRef`. - Implemented `projectContentsSameForRefreshRequire`. - Changed out old `haveProjectImportsChanged` call to use the new `projectContentsSameForRefreshRequire`.
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:
If we do a partial canvas re-render but a necessary import is also added, then the canvas errors out momentarily.
Cause:
The resolved values of the imports are buried in a property called
requireResult
which originates with require and resolve functions. Those functions are only rebuilt when the elements to re-render value isrerender-all-elements
or when it has changed between the current canvas render and the prior one. With our recent changes to the canvas strategies to make them never supply thererender-all-elements
value, the failure case of the imports changing but the elements to re-render value not changing has become more likely.In the case of grid insertion, the elements to re-render becomes the target path on hover, then when the user clicks it stays with that target path but the imports are added. Since there is no change in the former, the canvas logic is unable to find the new import in the old
requireResult
.Fix:
Compare the old and current project contents and if their imports, combined top level arbitrary block or exports have changed then recreate the require and resolve functions. This replaces the previous check which looked at the current and previous versions of the elements to re-render property.
Commit Details:
shouldRerenderRef
.projectContentsSameForRefreshRequire
.haveProjectImportsChanged
call to use the newprojectContentsSameForRefreshRequire
.