bvaughn/react-virtualized-auto-sizer

Recurrence of old Resizer bug (Width/Height NaN for AutoSizer #150)

saperdadsk opened this issue · 4 comments

Been seeing an error periodically when running some tests on our webpage via Cypress:

`NaN` is an invalid value for the `width` css style property

I don't currently have a consistent reproduction case - error only happens when running in the test environment.

I traced the error down to this library, and specifically https://github.com/bvaughn/react-virtualized-auto-sizer/blob/master/src/AutoSizer.ts#L155-L185, and noticed the comment there referencing an old issue on react-virtualized (bvaughn/react-virtualized#150). It looks like the checks added in bvaughn/react-virtualized@33bdde8 were modified at some point to use null-coalescing, which no longer handles empty string values.

I'll note we're still running on React 17 and Cypress 10.

Nice find. Would you be willing to put together a PR that fixes this? (I'm guessing just replacing the ?? with || would do it, but you have a way to verify the fix)

@bvaughn Sure - let me try it out

Opened a PR with a fix, though I can't figure out how to write tests for this (Spent way too long trying) - it looks like the JSDOM version in the repo doesn't support empty strings for padding

Fix published in react-virtualized-auto-sizer@1.0.22


❤️ → ☕ givebrian.coffee