-
Notifications
You must be signed in to change notification settings - Fork 356
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: Enable dynamic batches #3875
base: master
Are you sure you want to change the base?
Conversation
const gridSize = getColumnCount({ gutter, columnWidth, width, minCols, layout }); | ||
|
||
const moduleSize = calculateActualColumnSpan({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the tricky part of this implementation. These two values are easy to find in multiColumnLayout.ts
, but are not ready at this scope.
- For grid size, I created a whole new util that abstract the way we calculate the column count from both
DefaultLayout
andFullWidthLayout
(updating those utils to avoid code duplicity too). - For moduleSize, I exposed the
calculateActualColumnSpan
frommultiColumnLayout.ts
to be able to use it here.
All of this happens also in MasonryV2.
✅ Deploy Preview for gestalt ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
dd610f7
to
d9e4c8f
Compare
Summary
What changed?
This PR introduces
_getModulePositioningConfig
, an experimental prop to enable dynamic batch sizes (and Early bailout). This is a way to dynamically set the number of items used to position a multicolumn module._getModulePositioningConfig
uses two params (gridSize and moduleSize) and uses them to return aModulePositioningConfig
, which could have these values:Why?
This will allow us to reduce the whitespace from larger multicolumn modules.
Other changes:
GetColumnCount
to move the logic to know how many columns a grid have in a single placeImages confirming we have the correct module and grid sizes.