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

Disallow changing location for components which do not support style props #6624

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

gbalint
Copy link
Contributor

@gbalint gbalint commented Nov 7, 2024

Problem:
When a grid contains component items which do not support style props:

  • changing location should be disabled, because we can not attach the gridRow*, gridColumn* props on the component
  • reorder should still work, because that just modifies the order of the grid items as siblings

Fix:
I used MetadataUtils.targetRegisteredStyleControlsOrHonoursStyleProps to decide if a component supports the necessary grid placement style props:

  • if layout inspector section is enabled in the component annotations, we should allow changing location
  • if gridRow/gridColumn/etc props are taken by the component, then we should allow changing location
  • reorder does not need any constrains, it does not depend on style props

Manual Tests:
I hereby swear that:

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

@gbalint gbalint changed the title Disallow rearrange for components which do not support style props Disallow changing location for components which do not support style props Nov 7, 2024
Copy link
Contributor

github-actions bot commented Nov 7, 2024

Try me

Copy link

relativeci bot commented Nov 7, 2024

#15072 Bundle Size — 58.05MiB (~+0.01%).

d938db5(current) vs d1d46c1 master#15070(baseline)

Warning

Bundle contains 70 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#15072
     Baseline
#15070
Regression  Initial JS 41.03MiB(~+0.01%) 41.03MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 18.09% 17.98%
No change  Chunks 20 20
No change  Assets 22 22
No change  Modules 4166 4166
No change  Duplicate Modules 213 213
No change  Duplicate Code 27.31% 27.31%
No change  Packages 477 477
No change  Duplicate Packages 70 70
Bundle size by type  Change 2 changes Regression 1 regression Improvement 1 improvement
                 Current
#15072
     Baseline
#15070
Regression  JS 58.04MiB (~+0.01%) 58.04MiB
Improvement  HTML 7.37KiB (-0.25%) 7.39KiB

Bundle analysis reportBranch fix/rearrange-component-no-style...Project dashboard


Generated by RelativeCIDocumentationReport issue

@gbalint gbalint marked this pull request as ready for review November 7, 2024 17:09
@gbalint gbalint merged commit 004cc05 into master Nov 8, 2024
15 checks passed
@gbalint gbalint deleted the fix/rearrange-component-no-style-props branch November 8, 2024 12:51
liady pushed a commit that referenced this pull request Dec 13, 2024
…props (#6624)

**Problem:**
When a grid contains component items which do not support style props:
- changing location should be disabled, because we can not attach the
gridRow*, gridColumn* props on the component
- reorder should still work, because that just modifies the order of the
grid items as siblings

**Fix:**
I used MetadataUtils.targetRegisteredStyleControlsOrHonoursStyleProps to
decide if a component supports the necessary grid placement style props:
- if `layout` inspector section is enabled in the component annotations,
we should allow changing location
- if gridRow/gridColumn/etc props are taken by the component, then we
should allow changing location
- reorder does not need any constrains, it does not depend on style
props

**Manual Tests:**
I hereby swear that:

- [x] I opened a hydrogen project and it loaded
- [x] I could navigate to various routes in Play mode
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