Skip to content

Commit

Permalink
add timeout and only remove sensor in a very specific ase
Browse files Browse the repository at this point in the history
  • Loading branch information
jrchudy committed Dec 14, 2023
1 parent 20349b3 commit 83111bf
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/components/recordset/table-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ const TableRow = ({
return overflow === true
});

if (sensor && justOverflows.length === 0) sensor.detach();
// add length check so this only triggers for the reason from the above comment
if (sensor && rowValues.length === 1 && justOverflows.length === 0) sensor.detach();
}

// TODO: This assumes that tuple is set before rowValues. And that useEffect triggers before useLayoutEffect
Expand All @@ -160,9 +161,10 @@ const TableRow = ({
if (!rowContainer.current || disableMaxRowHeightFeature) return;
const tempSensor = new ResizeSensor(
rowContainer.current,
() => {
initializeOverflows();
}
() => setTimeout(() => {
initializeOverflows()
// images take ~200ms to load so wait at least that long before running
}, 200)
)

setSensor(tempSensor);
Expand Down

0 comments on commit 83111bf

Please sign in to comment.