mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-09 00:27:37 +03:00
Fix DraggableGridLayout initial height collapse due to nullish coalescing bug
availableWidth starts at 0 (not null/undefined) before ResizeObserver fires. The ?? operator passes 0 through instead of falling back to window.innerWidth, making cellHeight negative and causing react-grid-layout to render a ~10px container. The overflow-x-hidden div then becomes an implicit scroll container, producing the 'cards squeezed in a small rectangle' symptom. Changing ?? to || makes 0 trigger the window.innerWidth fallback, giving a reasonable initial rowHeight until the real container width is measured. https://claude.ai/code/session_01H1sqbcFmtwwsdNTJcJHJWd
This commit is contained in:
parent
a0ca322129
commit
84f3b16461
@ -359,7 +359,7 @@ export default function DraggableGridLayout({
|
|||||||
// subtract container margin, 1 camera takes up at least 4 rows
|
// subtract container margin, 1 camera takes up at least 4 rows
|
||||||
// account for additional margin on bottom of each row
|
// account for additional margin on bottom of each row
|
||||||
return (
|
return (
|
||||||
((availableWidth ?? window.innerWidth) - 2 * marginValue) /
|
((availableWidth || window.innerWidth) - 2 * marginValue) /
|
||||||
12 /
|
12 /
|
||||||
aspectRatio -
|
aspectRatio -
|
||||||
marginValue +
|
marginValue +
|
||||||
@ -712,7 +712,7 @@ export default function DraggableGridLayout({
|
|||||||
/>
|
/>
|
||||||
<Responsive
|
<Responsive
|
||||||
className="grid-layout"
|
className="grid-layout"
|
||||||
width={availableWidth ?? window.innerWidth}
|
width={availableWidth || window.innerWidth}
|
||||||
layouts={{
|
layouts={{
|
||||||
lg: currentGridLayout,
|
lg: currentGridLayout,
|
||||||
md: currentGridLayout,
|
md: currentGridLayout,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user