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

Respect spans when resizing grid cells #6685

Merged
merged 3 commits into from
Nov 27, 2024
Merged

Conversation

ruggi
Copy link
Contributor

@ruggi ruggi commented Nov 26, 2024

Problem:

Resizing grid cells always forces explicit numerical placement pins, chomping any spans that may have been defined on the cell.

Fix:

After determining the right numerical positions for the resized cell bounds, do a normalization pass so that the new grid props are rewritten to respect the new bounds but also to express them with spans if the original pins were spans in the first place.

For example, assuming enlarging to the right by 1 cell:

Initial Result
gridColumn: span 2 gridColumn: span 3
gridColumn 3 / span 2 gridColumn: 3 / span 3

Manual Tests:
I hereby swear that:

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

Fixes #6683

Copy link
Contributor

github-actions bot commented Nov 26, 2024

Try me

Copy link

relativeci bot commented Nov 26, 2024

#15303 Bundle Size — 58.12MiB (~+0.01%).

6be5569(current) vs d1d46c1 master#15294(baseline)

Warning

Bundle contains 70 duplicate packages – View duplicate packages

Bundle metrics  Change 2 changes Regression 1 regression
                 Current
#15303
     Baseline
#15294
Regression  Initial JS 41.09MiB(~+0.01%) 41.09MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 18.19% 18.07%
No change  Chunks 20 20
No change  Assets 22 22
No change  Modules 4174 4174
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
#15303
     Baseline
#15294
Regression  JS 58.11MiB (~+0.01%) 58.11MiB
Improvement  HTML 9.4KiB (-0.21%) 9.42KiB

Bundle analysis reportBranch fix/grid-cell-resize-spansProject dashboard


Generated by RelativeCIDocumentationReport issue

const elementGridPropertiesFromProps =
selectedElementMetadata.specialSizeMeasurements.elementGridPropertiesFromProps

const width =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the term width/height because I'm always mistaken that it is a geometrical width/height (in pixels). Is there a better name for this? Maybe columnCount and rowCount

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes total sense, fixed in 6be5569 (#6685)

@ruggi ruggi merged commit 6b3c5a2 into master Nov 27, 2024
16 checks passed
@ruggi ruggi deleted the fix/grid-cell-resize-spans branch November 27, 2024 10:01
liady pushed a commit that referenced this pull request Dec 13, 2024
**Problem:**

Resizing grid cells always forces explicit numerical placement pins,
chomping any `span`s that may have been defined on the cell.

**Fix:**

After determining the right numerical positions for the resized cell
bounds, do a normalization pass so that the new grid props are rewritten
to respect the new bounds but also to express them with `spans` if the
original pins were spans in the first place.

For example, assuming enlarging to the right by 1 cell:

| Initial | Result |
|--------|----------|
| `gridColumn: span 2` | `gridColumn: span 3` |
| `gridColumn 3 / span 2` | `gridColumn: 3 / span 3` |

**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

Fixes #6683
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.

Respect spans when resizing grid items
3 participants