move line index logic

Signed-off-by: Ben Vu <benv@spotify.com>
This commit is contained in:
Ben Vu
2025-04-24 12:09:35 -04:00
parent d28ebc90c1
commit 5cf89b373d
2 changed files with 3 additions and 3 deletions
@@ -177,8 +177,7 @@ export function LogLine({
useEffect(() => {
if (lineRef.current && setRowHeight) {
// lineNumber is 1-based but height index is 0-based
setRowHeight(line.lineNumber - 1, lineRef.current.offsetHeight);
setRowHeight(line.lineNumber, lineRef.current.offsetHeight);
}
}, [line.lineNumber, setRowHeight]);
@@ -87,7 +87,8 @@ export function RealLogViewer(props: RealLogViewerProps) {
function setRowHeight(index: number, size: number) {
if (shouldTextWrap && listInstance) {
(listInstance as VariableSizeList<AnsiLine[]>).resetAfterIndex(0);
heights.current = { ...heights.current, [index]: size };
// lineNumber is 1-based but index is 0-based
heights.current = { ...heights.current, [index - 1]: size };
}
}