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

Share target finding logic between paste and one-shot insertion #4369

Merged
merged 12 commits into from
Oct 16, 2023

Conversation

bkrmendy
Copy link
Contributor

@bkrmendy bkrmendy commented Oct 13, 2023

Problem

When adding an element via A for Add (the one-shot insertion), the action will often fail because the selected element does not support children. This is because we try to add the element always only into the selected element.

Fix

Use the same logic to find a target parent we use for pasting (after some refactoring). The way this is accomplished is that getTargetParentForPaste is refactored into smaller target finding functions (checkComponentNotInsertedIntoOwnDefinition, insertIntoSlot, pasteNextToSameSizedElement, pasteIntoParentOrGrandparent), and a new target finding function is created (getTargetParentForOneShotInsertion), which is made up of these smaller functions.

The reason the two functions cannot be the same is that pasteNextToSameSizedElement expects the newly inserted elements to already have metadata, and elements inserted via one-shot insertion don't have any metadata.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

Try me

@relativeci
Copy link

relativeci bot commented Oct 13, 2023

Job #8665: Bundle Size — 63.28MiB (~+0.01%).

9493a79(current) vs 5957b21 master#8656(baseline)

Warning

Bundle contains 64 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
Job #8665
     Baseline
Job #8656
Regression  Initial JS 35.56MiB(~+0.01%) 35.56MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 19.83% 0%
No change  Chunks 28 28
No change  Assets 32 32
No change  Modules 4014 4014
No change  Duplicate Modules 455 455
No change  Duplicate Code 31.36% 31.36%
No change  Packages 409 409
No change  Duplicate Packages 64 64
Bundle size by type  Change 1 change Regression 1 regression
                 Current
Job #8665
     Baseline
Job #8656
Regression  JS 63.27MiB (~+0.01%) 63.26MiB
Not changed  HTML 11.54KiB 11.54KiB

View job #8665 reportView feature/insert-target-finding branch activity

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

Performance test results:
(Chart1)
(Chart2)

@bkrmendy bkrmendy marked this pull request as ready for review October 16, 2023 10:46
@bkrmendy bkrmendy changed the title Share target finding function between paste and one-shot insertion Share target finding logic between paste and one-shot insertion Oct 16, 2023
@bkrmendy bkrmendy merged commit 1cba9a9 into master Oct 16, 2023
11 checks passed
@bkrmendy bkrmendy deleted the feature/insert-target-finding branch October 16, 2023 13:23
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