diff --git a/ui/src/timespan/DoneTrackers.tsx b/ui/src/timespan/DoneTrackers.tsx index 9b38115..26c0c26 100644 --- a/ui/src/timespan/DoneTrackers.tsx +++ b/ui/src/timespan/DoneTrackers.tsx @@ -114,6 +114,7 @@ export const DoneTrackers: React.FC = ({addTagsToTracker}) => timeSpans={timeSpans} addTagsToTracker={addTagsToTracker} setHeight={setHeights} + height={heights[key] || 500} /> ); })} @@ -125,14 +126,16 @@ export const DoneTrackers: React.FC = ({addTagsToTracker}) => const DatedTimeSpans: React.FC<{ name: string; setHeight: (cb: (height: Record) => Record) => void; + height: number; timeSpans: TimeSpanProps[]; -} & DoneTrackersProps> = ({name, timeSpans, addTagsToTracker, setHeight}) => { +} & DoneTrackersProps> = ({name, timeSpans, addTagsToTracker, setHeight, height}) => { const ref = React.useRef(); React.useEffect(() => { - if (ref.current) { - setHeight((old) => ({...old, [name]: ref.current!.getBoundingClientRect().height})); + const currentHeight = ref.current && ref.current.getBoundingClientRect().height; + if (currentHeight != null && currentHeight !== height) { + setHeight((old) => ({...old, [name]: currentHeight})); } - }, [ref, name, setHeight]); + }, [ref, name, setHeight, height]); return (
(ref.current = r)}>