mirror of
https://github.com/wavetermdev/waveterm
synced 2026-05-23 08:48:28 +00:00
Fix row pinning effect so it always runs (#2022)
The old effect wasn't running on every data change, since it depended on table, which is a ref. Now, it will always run on any data change and as a Layout Effect so it will run before paint.
This commit is contained in:
parent
d469432b75
commit
a1950fd6f6
1 changed files with 3 additions and 3 deletions
|
|
@ -29,7 +29,7 @@ import clsx from "clsx";
|
|||
import dayjs from "dayjs";
|
||||
import { PrimitiveAtom, atom, useAtom, useAtomValue, useSetAtom } from "jotai";
|
||||
import { OverlayScrollbarsComponent, OverlayScrollbarsComponentRef } from "overlayscrollbars-react";
|
||||
import React, { Fragment, memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import React, { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
||||
import { useDrag, useDrop } from "react-dnd";
|
||||
import { quote as shellQuote } from "shell-quote";
|
||||
import { debounce } from "throttle-debounce";
|
||||
|
|
@ -383,7 +383,7 @@ function DirectoryTable({
|
|||
setSelectedPath((allRows[focusIndex]?.getValue("path") as string) ?? null);
|
||||
}, [table, focusIndex, data]);
|
||||
|
||||
useEffect(() => {
|
||||
useLayoutEffect(() => {
|
||||
const rows = table.getRowModel()?.flatRows;
|
||||
for (const row of rows) {
|
||||
if (row.getValue("name") == "..") {
|
||||
|
|
@ -391,7 +391,7 @@ function DirectoryTable({
|
|||
return;
|
||||
}
|
||||
}
|
||||
}, [table]);
|
||||
}, [table, data]);
|
||||
const columnSizeVars = useMemo(() => {
|
||||
const headers = table.getFlatHeaders();
|
||||
const colSizes: { [key: string]: number } = {};
|
||||
|
|
|
|||
Loading…
Reference in a new issue