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

Masonry: Update fullWidthLayout to not floor column widths #3874

Merged
merged 3 commits into from
Nov 15, 2024

Conversation

liuyenwei
Copy link
Contributor

Summary

Currently, when calculating column widths via fullWidthLayout, the values of the column widths are rounded down via Math.floor.

Because we rely on CSS (specifically calc) for the initial server render, this can actually cause slight layout shifts when going from server render -> client render due to the slight difference in widths
image
image

While visually, this is not an issue (due to the shift being so tiny), this can actually result in LCP regressions since this results in a repaint.

This PR addresses the issue by removing the Math.floor. After this change, the column width will stay consistent between server and client render

@liuyenwei liuyenwei requested a review from a team as a code owner November 15, 2024 01:15
@AlbertCarreras AlbertCarreras added the patch release Patch release label Nov 15, 2024
Copy link

netlify bot commented Nov 15, 2024

Deploy Preview for gestalt ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 63ef9e1
🔍 Latest deploy log https://app.netlify.com/sites/gestalt/deploys/673792f35bf1c1000812591c
😎 Deploy Preview https://deploy-preview-3874--gestalt.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@liuyenwei liuyenwei enabled auto-merge (squash) November 15, 2024 18:30
@liuyenwei liuyenwei merged commit 656fe6b into pinterest:master Nov 15, 2024
13 checks passed
liuyenwei added a commit that referenced this pull request Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch release Patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants