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

Replace root element of component #5681

Merged
merged 8 commits into from
May 16, 2024
Merged

Replace root element of component #5681

merged 8 commits into from
May 16, 2024

Conversation

bkrmendy
Copy link
Contributor

@bkrmendy bkrmendy commented May 15, 2024

Try it here

Problem

#5464

Fix

Separate the code that replaces elements from the code that inserts elements, and in the new replace code, "surgically" update the element to be replaced.

Commit Details

  • The PR adds a new action,ReplaceJSXElement, which is specifically geared towards replacing elements. The replacing-related code is removed from InsertJSXElement
  • modifyUnderlyingParseSuccessOnly is added, since it turned out that modifyUnderlyingTarget throws an error if its target element is removed in its callback.

Manual Tests:
I hereby swear that:

  • I opened a hydrogen project and it loaded
  • I could navigate to various routes in Preview mode

Copy link
Contributor

github-actions bot commented May 15, 2024

Try me

Copy link

relativeci bot commented May 15, 2024

#12467 Bundle Size — 62.13MiB (~+0.01%).

3e96322(current) vs 6339ece master#12464(baseline)

Warning

Bundle contains 52 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#12467
     Baseline
#12464
Regression  Initial JS 45.19MiB(~+0.01%) 45.19MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 22.16% 21.91%
No change  Chunks 31 31
No change  Assets 34 34
No change  Modules 4276 4276
No change  Duplicate Modules 509 509
No change  Duplicate Code 31.01% 31.01%
No change  Packages 449 449
No change  Duplicate Packages 52 52
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#12467
     Baseline
#12464
Regression  JS 62.12MiB (~+0.01%) 62.12MiB
Improvement  HTML 10.94KiB (-0.34%) 10.98KiB

Bundle analysis reportBranch fix/replace-root-elementProject dashboard

Copy link
Contributor

github-actions bot commented May 15, 2024

Performance test results:
(Chart1)
(Chart2)

@bkrmendy bkrmendy changed the title wip Replace root element of component May 15, 2024
@bkrmendy bkrmendy marked this pull request as ready for review May 15, 2024 13:17
@bkrmendy bkrmendy linked an issue May 15, 2024 that may be closed by this pull request
Copy link
Contributor

@balazsbajorics balazsbajorics left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@bkrmendy bkrmendy merged commit 1520ede into master May 16, 2024
17 checks passed
@bkrmendy bkrmendy deleted the fix/replace-root-element branch May 16, 2024 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replace Element is broken for the root element of a component
3 participants