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

Better grid reparent #6499

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Better grid reparent #6499

wants to merge 4 commits into from

Conversation

gbalint
Copy link
Contributor

@gbalint gbalint commented Oct 8, 2024

Problem:
One of the root causes of some major issues is that the grid reparent strategies were not created by the general reparent-metastrategy, but the grid-rearrange-move strategy itself.

Fix:

  • Removed reparent strategy creation from grid-rearrange-move. After this grid-rearrange-move is always selectable when dragging from a grid, even when outside of a grid (so you can manually switch to this strategy and the child will jump back to the original grid, into the cell which is closest to the mouse). This is a behavior which is similar to flex reorder.
  • reparent-metastrategy can create a reparent into grid strategy. To achieve this I just had to allow GRID_CELL_HANDLE controls in the strategy factory.
  • Fortunately reparent-metastrategy does not allow reparenting into the same parent, so this automagically solved the problem that reparenting inside the original grid should just do a rearrange (because the reparent strategy is not even selectable in that case)
  • With this solution, when reparenting from one grid to a different grid, the grid controls were shown on both the original and the new parent grid too. Unfortunately, the grid controls do not support showing the controls on multiple grid instances at the same time (e.g. they shared the state that which cell was highlighted), so I had to switch the grid control of the rearrange strategy to visible-only-while-active (so it is not visible on the original grid when the reparent strategy is active)
  • I had to make sure the grid specific style props are removed during all kinds of reparent (earlier this was manually handled in the grid specific code)
  • I could remove plenty of reparent specific code lines from grid-rearrange-move-strategy.ts

Manual Tests:
I hereby swear that:

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

Copy link
Contributor

github-actions bot commented Oct 8, 2024

Try me

Copy link

relativeci bot commented Oct 8, 2024

#14651 Bundle Size — 57.74MiB (~-0.01%).

377d5e0(current) vs 916e8b9 master#14647(baseline)

Warning

Bundle contains 70 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Improvement 1 improvement
                 Current
#14651
     Baseline
#14647
Improvement  Initial JS 40.74MiB(~-0.01%) 40.74MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 17.97% 17.95%
No change  Chunks 21 21
No change  Assets 23 23
No change  Modules 4113 4113
No change  Duplicate Modules 213 213
No change  Duplicate Code 27.41% 27.41%
No change  Packages 475 475
No change  Duplicate Packages 70 70
Bundle size by type  Change 2 changes Improvement 2 improvements
                 Current
#14651
     Baseline
#14647
Improvement  JS 57.73MiB (~-0.01%) 57.73MiB
Improvement  HTML 7.37KiB (-0.25%) 7.39KiB

Bundle analysis reportBranch chore/better-grid-reparentProject dashboard


Generated by RelativeCIDocumentationReport issue

@gbalint gbalint marked this pull request as ready for review October 8, 2024 16:34
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.

1 participant