-
Notifications
You must be signed in to change notification settings - Fork 174
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
Grid component support preparation #6636
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#15125 Bundle Size — 58.08MiB (~+0.01%).b791ff5(current) vs d1d46c1 master#15114(baseline) Warning Bundle contains 70 duplicate packages – View duplicate packages Bundle metrics
Bundle size by type
Bundle analysis report Branch chore/grid-component-support Project dashboard Generated by RelativeCI Documentation Report issue |
ruggi
approved these changes
Nov 13, 2024
bkrmendy
approved these changes
Nov 14, 2024
This was referenced Nov 15, 2024
Merged
gbalint
added a commit
that referenced
this pull request
Nov 18, 2024
**Problem:** Followup to #6636 The goal is to support interaction with grid item in the following scenario: - the grid is in a component - the grid renders the component's children - the grid is not the root element of the component **Fix:** In #6636 I introduced a way to indentify a grid using the element path of its item (which is necessary because when the grid is in a non-focused component). - `GridMeasurementHelper` collects the grids from the metadata. These grids in non-focused components are not in the metadata, so they are not collected. I fixed this by collecting component items from the grids too. - To get the measurement data for these grids which identified by their items, I added a new parameter to `getGridMeasurementHelperData` so it can get the styling of the parentElement of the item's element. - The measurement helper was identified by its element path, and the dom-sampler could retrieve the helper from the dom using that. However, this is again not a good solution for these grids in non-focused components, so I added global WeakMap which stores the pairing between HTMLElements of grids and the id attribute of their GridMeasurementHelper. - I updated the `path` fiels names of `GridContainerIdentifier` and `GridItemIdentifier`: it was not a good idea to use the same name in the two paths, because it was possible to not check the type and use the path field. **Missing:** `gridMoveStrategiesExtraCommands` still tries to set grid props on the parent, and when it is a component, those can be absolutely useless. We should detect when that is the case, and not generate these commands. **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
seanparsons
pushed a commit
that referenced
this pull request
Nov 18, 2024
**Problem:** Followup to #6636 The goal is to support interaction with grid item in the following scenario: - the grid is in a component - the grid renders the component's children - the grid is not the root element of the component **Fix:** In #6636 I introduced a way to indentify a grid using the element path of its item (which is necessary because when the grid is in a non-focused component). - `GridMeasurementHelper` collects the grids from the metadata. These grids in non-focused components are not in the metadata, so they are not collected. I fixed this by collecting component items from the grids too. - To get the measurement data for these grids which identified by their items, I added a new parameter to `getGridMeasurementHelperData` so it can get the styling of the parentElement of the item's element. - The measurement helper was identified by its element path, and the dom-sampler could retrieve the helper from the dom using that. However, this is again not a good solution for these grids in non-focused components, so I added global WeakMap which stores the pairing between HTMLElements of grids and the id attribute of their GridMeasurementHelper. - I updated the `path` fiels names of `GridContainerIdentifier` and `GridItemIdentifier`: it was not a good idea to use the same name in the two paths, because it was possible to not check the type and use the path field. **Missing:** `gridMoveStrategiesExtraCommands` still tries to set grid props on the parent, and when it is a component, those can be absolutely useless. We should detect when that is the case, and not generate these commands. **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
liady
pushed a commit
that referenced
this pull request
Dec 13, 2024
**Problem:** This PR is a preparation step to support strategies for grid items in the following scenario: - the grid is in a component - the grid renders the component's children - the grid is not the root element of the component The main issue is that we still identify the grid control using the element path of the grid, even though that grid doesn't have a path in this case. We need to be able to show and manage a grid control using the element path of one of its items. **Fix:** Instead of storing the element path of the `GridControlData`, I introduced a new type `GridIdentifier` which can identify a grid either by its container element path, or an item's element path. I updated the strategies and commands to use this grid identifier, and also made sure the strategies for grid items identify using the item, and do not refer to the parent path as the grid. (For reparent we can not really do that, because the item is not in the grid yet. Solving that is not in scope now). What is missing: I still use mostly the old control implementations, it only works now because the `useGridData` hook converts GridItemIdentifier-s to a GridContainerIdentifier-s (using parentPath). So this PR is just a preparation, it does not solve the component problem yet. Next step is to make sure the control can render on the parent element when it receives a GridItemIdentifier. **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
liady
pushed a commit
that referenced
this pull request
Dec 13, 2024
**Problem:** Followup to #6636 The goal is to support interaction with grid item in the following scenario: - the grid is in a component - the grid renders the component's children - the grid is not the root element of the component **Fix:** In #6636 I introduced a way to indentify a grid using the element path of its item (which is necessary because when the grid is in a non-focused component). - `GridMeasurementHelper` collects the grids from the metadata. These grids in non-focused components are not in the metadata, so they are not collected. I fixed this by collecting component items from the grids too. - To get the measurement data for these grids which identified by their items, I added a new parameter to `getGridMeasurementHelperData` so it can get the styling of the parentElement of the item's element. - The measurement helper was identified by its element path, and the dom-sampler could retrieve the helper from the dom using that. However, this is again not a good solution for these grids in non-focused components, so I added global WeakMap which stores the pairing between HTMLElements of grids and the id attribute of their GridMeasurementHelper. - I updated the `path` fiels names of `GridContainerIdentifier` and `GridItemIdentifier`: it was not a good idea to use the same name in the two paths, because it was possible to not check the type and use the path field. **Missing:** `gridMoveStrategiesExtraCommands` still tries to set grid props on the parent, and when it is a component, those can be absolutely useless. We should detect when that is the case, and not generate these commands. **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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
This PR is a preparation step to support strategies for grid items in the following scenario:
The main issue is that we still identify the grid control using the element path of the grid, even though that grid doesn't have a path in this case. We need to be able to show and manage a grid control using the element path of one of its items.
Fix:
Instead of storing the element path of the
GridControlData
, I introduced a new typeGridIdentifier
which can identify a grid either by its container element path, or an item's element path.I updated the strategies and commands to use this grid identifier, and also made sure the strategies for grid items identify using the item, and do not refer to the parent path as the grid. (For reparent we can not really do that, because the item is not in the grid yet. Solving that is not in scope now).
What is missing:
I still use mostly the old control implementations, it only works now because the
useGridData
hook converts GridItemIdentifier-s to a GridContainerIdentifier-s (using parentPath). So this PR is just a preparation, it does not solve the component problem yet. Next step is to make sure the control can render on the parent element when it receives a GridItemIdentifier.Manual Tests:
I hereby swear that: