mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-17 21:58:22 +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
|
||||
// account for additional margin on bottom of each row
|
||||
return (
|
||||
((availableWidth ?? window.innerWidth) - 2 * marginValue) /
|
||||
((availableWidth || window.innerWidth) - 2 * marginValue) /
|
||||
12 /
|
||||
aspectRatio -
|
||||
marginValue +
|
||||
@ -712,7 +712,7 @@ export default function DraggableGridLayout({
|
||||
/>
|
||||
<Responsive
|
||||
className="grid-layout"
|
||||
width={availableWidth ?? window.innerWidth}
|
||||
width={availableWidth || window.innerWidth}
|
||||
layouts={{
|
||||
lg: currentGridLayout,
|
||||
md: currentGridLayout,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user