react-grid-layout: measureBeforeMount breaks responsive grid layout

Describe the bug

If measureBeforeMount is set totrue, all grid items within a responsive grid (WidthProvider) will have an x value of ‘0’, causing them to be rearranged into a single column.

Your Example Website or App

https://codesandbox.io/s/hardcore-snowflake-mx8gnp?file=/src/ShowcaseLayout.js

Steps to Reproduce the Bug or Issue

  1. Go to https://codesandbox.io/s/hardcore-snowflake-mx8gnp?file=/src/ShowcaseLayout.js
  2. Compare layouts when measureBeforeMount is set to true vs false

Expected behavior

WithProvider to correctly set the width of the grid container.

react-grid-layout library version

1.4.1

Operating System Version

Windows

Browser

Chrome

Additional context

No response

Screenshots or Videos

No response

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 19
  • Comments: 16

Most upvoted comments

downgraded to 1.3 fixed the issue