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

Fix uid duplication during paste #4833

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

bkrmendy
Copy link
Contributor

@bkrmendy bkrmendy commented Feb 5, 2024

Problem

Pasting into slots might introduce duplicate uids into projects

Root cause

When an element is pasted, we first look for a target parent, and then "fix" the uids of the pasted elements (to avoid duplicate uids). However, if an element is pasted into a slot, we need to pre-generate a uid for the fragment the pasted element might be wrapped into. The uid of this fragment wrapper might clash with one of the new uids generated during the fixing process.

The reason this only came out now is that

  • pasting into a slot with a fragment wrapper is an edge case in itself (since it only happens when the content of a slot goes from a single child to multiple children)
  • the fragment uid is generated from a UUID() call, while the new uids of the pasted elements are deterministically generated based on the uids already present in the project, and the test project is very small, so it's very unlikely that an already-existing uid would be generated

Fix

When initializing the mapping for new uids (fixedUIDMappingNewUIDS), consider the uid of the fragment wrapper (if one is used).

Copy link
Contributor

github-actions bot commented Feb 5, 2024

Try me

Copy link

relativeci bot commented Feb 5, 2024

Job #10219: Bundle Size — 62.35MiB (~+0.01%).

a33dfdf(current) vs 794431b master#10213(baseline)

Warning

Bundle contains 66 duplicate packages – View duplicate packages

Bundle metrics  Change 1 change Regression 1 regression
                 Current
Job #10219
     Baseline
Job #10213
Regression  Initial JS 35.39MiB(~+0.01%) 35.38MiB
No change  Initial CSS 0B 0B
No change  Cache Invalidation 21.79% 21.79%
No change  Chunks 28 28
No change  Assets 32 32
No change  Modules 4407 4407
No change  Duplicate Modules 490 490
No change  Duplicate Code 30.7% 30.7%
No change  Packages 462 462
No change  Duplicate Packages 65 65
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
Job #10219
     Baseline
Job #10213
Regression  JS 62.34MiB (~+0.01%) 62.33MiB
Improvement  HTML 11.37KiB (-0.32%) 11.41KiB

View job #10219 reportView fix/static-reparent-wrapper-uid-... branch activityView project dashboard

Copy link
Contributor

github-actions bot commented Feb 5, 2024

Performance test results:
(Chart1)
(Chart2)

…to fix/static-reparent-wrapper-uid-duplication
@bkrmendy bkrmendy changed the title Fix/static-reparent-wrapper-uid-duplication Fix uid duplication during paste Feb 5, 2024
@bkrmendy bkrmendy marked this pull request as ready for review February 5, 2024 11:54
@bkrmendy bkrmendy merged commit 4323eed into master Feb 5, 2024
15 checks passed
@bkrmendy bkrmendy deleted the fix/static-reparent-wrapper-uid-duplication branch February 5, 2024 14:17
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.

3 participants