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

Disable grid control strategies for components which don't support style props #6610

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

gbalint
Copy link
Contributor

@gbalint gbalint commented Oct 31, 2024

Problem:
Now it is possible to use the gap and the grid resize controls on components which do not support style props.

Fix:
We somehow have to decide whether a component supports style props or not. I implemented the following heuristics, but we can improve that later if necessary:

  1. If a component has a descriptor and it allows 'layout-system' section to be shown then it supports style props.
  2. If it doesn't have a descriptor then we check if the component implementation takes the necessary style props (similarly to the already existing targetSupportsPropsSize function). This returns true when the component implementation can not be found (if it is an external component)

Note: When the component does not support the necessary style props:

  • I don't show the gap control, but it is just misleading if it is there
  • I show the grid resize controls, because they show information (row/column size), which is meaningful even if the control is not interactive.
    These are just draft solution, so a followup task is necessary to design/implement the the non-interactive state of the controls

Commit Details: (< vv pls delete this section if's not relevant)

-targetRegisteredStyleControlsOrHonoursStyleProps is the main function which decides whether a component supports style props for the actual control. You can give an inspector section to check (if that is enabled from the annotation, it returns true), and a list of props (if they are referred inside the component we return true).

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 31, 2024

Try me

Copy link

relativeci bot commented Oct 31, 2024

#14987 Bundle Size — 58.04MiB (~+0.01%).

0304a9d(current) vs d1d46c1 master#14984(baseline)

Warning

Bundle contains 70 duplicate packages – View duplicate packages

Bundle metrics  Change 3 changes Regression 1 regression
                 Current
#14987
     Baseline
#14984
Regression  Initial JS 41.01MiB(~+0.01%) 41.01MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 18.07% 17.95%
No change  Chunks 20 20
No change  Assets 22 22
No change  Modules 4164 4164
No change  Duplicate Modules 213 213
Change  Duplicate Code 27.31%(-0.04%) 27.32%
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
#14987
     Baseline
#14984
Regression  JS 58.03MiB (~+0.01%) 58.02MiB
Improvement  HTML 7.37KiB (-0.25%) 7.39KiB

Bundle analysis reportBranch feature/disable-grid-strategiesProject dashboard


Generated by RelativeCIDocumentationReport issue

@gbalint gbalint marked this pull request as ready for review October 31, 2024 16:30
@gbalint gbalint merged commit 71e3817 into master Oct 31, 2024
20 checks passed
@gbalint gbalint deleted the feature/disable-grid-strategies branch October 31, 2024 16:56
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