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

Grid Element Direct Lookup Ordered Correctly. #6667

Merged
merged 5 commits into from
Nov 22, 2024

Conversation

seanparsons
Copy link
Contributor

@seanparsons seanparsons commented Nov 20, 2024

Problem:
Grid children should have their properties and dimensions retrieved directly the way we've done for grids.

Fix:
Some additional supporting functions similar to those implemented for grids were implemented for the children of grids. Those were implemented into the controls that still referred to the metadata for the dimensions and grid properties of those elements.

In the process of testing the above work, it was discovered that the flow of data wasn't quite what was expected. With the DOM sampler running before the helper controls were re-rendered, which resulted in some values suffering from the 1-frame behind problem. To solve that an additional store was added just for the helper controls so that now the following ordering is observed:

  • Update changes the model.
  • The canvas is rendered.
  • The helper controls are rendered.
  • The DOM sampler runs.
  • Everything else in the editor is rendered.

Commit Details:

  • Moved a lot of common types and functions used when obtaining values from elements for grids into grid-measurements.tsx.
  • Added getGridElementMeasurementHelperData to retrieve the necessary details for a grid element, along with some supporting functions.
  • Extracted out a getGlobalFrame function for the common lookup used.
  • Changed some test ID values in two components as they created the same ones.
  • PaddingResizeControl set to the bottom priority so that it doesn't end up on top of the track resizing controls.
  • GridControl now gets the cell dimensions directly from the grid element.
  • GridElementContainingBlock gets the grid child dimensions directly.
  • Added HelperControlsStateContext and made the connected change to StoreName.
  • Added helperControlsStore to Editor.
  • Added contexts for the helper store to EditorRoot and HotRoot.
  • Wrapped the contents of GridElementContainingBlocks and GridMeasurementHelpers with the new helper store context.
  • Added calls to update the helper store in the regular and test dispatch flows.

Manual Tests:
I hereby swear that:

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

- Moved a lot of common types and functions used when obtaining values
  from elements for grids into `grid-measurements.tsx`.
- Added `getGridElementMeasurementHelperData` to retrieve the
  necessary details for a grid element, along with some supporting functions.
- Extracted out a `getGlobalFrame` function for the common lookup used.
- Changed some test ID values in two components as they created the same ones.
- `PaddingResizeControl` set to the `bottom` priority so that it doesn't end up
  on top of the track resizing controls.
- `GridControl` now gets the cell dimensions directly from the grid element.
- `GridElementContainingBlock` gets the grid child dimensions directly.
- Added `HelperControlsStateContext` and made the connected change to `StoreName`.
- Added `helperControlsStore` to `Editor`.
- Added contexts for the helper store to `EditorRoot` and `HotRoot`.
- Wrapped the contents of `GridElementContainingBlocks` and `GridMeasurementHelpers`
  with the new helper store context.
- Added calls to update the helper store in the regular and test dispatch flows.
Copy link
Contributor

github-actions bot commented Nov 20, 2024

Try me

Copy link

relativeci bot commented Nov 20, 2024

#15257 Bundle Size — 58.11MiB (~+0.01%).

107c6d3(current) vs d1d46c1 master#15256(baseline)

Warning

Bundle contains 70 duplicate packages – View duplicate packages

Bundle metrics  Change 3 changes Regression 1 regression
                 Current
#15257
     Baseline
#15256
Regression  Initial JS 41.08MiB(~+0.01%) 41.08MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 18.17% 18.05%
No change  Chunks 20 20
No change  Assets 22 22
Change  Modules 4173(+0.02%) 4172
No change  Duplicate Modules 213 213
No change  Duplicate Code 27.28% 27.28%
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
#15257
     Baseline
#15256
Regression  JS 58.1MiB (~+0.01%) 58.1MiB
Improvement  HTML 7.37KiB (-0.25%) 7.39KiB

Bundle analysis reportBranch fix/grid-element-direct-lookupProject dashboard


Generated by RelativeCIDocumentationReport issue

@seanparsons seanparsons merged commit 0e30131 into master Nov 22, 2024
3 checks passed
@seanparsons seanparsons deleted the fix/grid-element-direct-lookup branch November 22, 2024 13:46
liady pushed a commit that referenced this pull request Dec 13, 2024
- Moved a lot of common types and functions used when obtaining values
from elements for grids into `grid-measurements.tsx`.
- Added `getGridElementMeasurementHelperData` to retrieve the necessary
details for a grid element, along with some supporting functions.
- Extracted out a `getGlobalFrame` function for the common lookup used.
- Changed some test ID values in two components as they created the same
ones.
- `PaddingResizeControl` set to the `bottom` priority so that it doesn't
end up on top of the track resizing controls.
- `GridControl` now gets the cell dimensions directly from the grid
element.
- `GridElementContainingBlock` gets the grid child dimensions directly.
- Added `HelperControlsStateContext` and made the connected change to
`StoreName`.
- Added `helperControlsStore` to `Editor`.
- Added contexts for the helper store to `EditorRoot` and `HotRoot`.
- Wrapped the contents of `GridElementContainingBlocks` and
`GridMeasurementHelpers` with the new helper store context.
- Added calls to update the helper store in the regular and test
dispatch flows.
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