You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**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
Copy file name to clipboardexpand all lines: editor/src/components/canvas/canvas-strategies/strategies/grid-change-element-location-duplicate-strategy.ts
Copy file name to clipboardexpand all lines: editor/src/components/canvas/canvas-strategies/strategies/grid-change-element-location-keyboard-strategy.ts
0 commit comments