Skip to content

Commit 164062b

Browse files
authored
Revert "remove refreshKey, which was causing multiple grid rendering issue (#18710)" (#18823)
This reverts commit 604cd25.
1 parent 4d89d34 commit 164062b

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/reactviews/pages/QueryResult/queryResultPane.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ export const QueryResultPane = () => {
428428

429429
const renderGridPanel = () => {
430430
const grids = [];
431+
gridRefs.current.forEach((r) => r?.refreshGrid());
431432
let count = 0;
432433
for (const batchIdStr in state?.resultSetSummaries ?? {}) {
433434
const batchId = parseInt(batchIdStr);

src/reactviews/pages/QueryResult/resultGrid.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
useEffect,
1111
useImperativeHandle,
1212
useRef,
13+
useState,
1314
} from "react";
1415
import "../../media/slickgrid.css";
1516
import { ACTIONBAR_WIDTH_PX, range, Table } from "./table/table";
@@ -79,6 +80,7 @@ const ResultGrid = forwardRef<ResultGridHandle, ResultGridProps>(
7980
return undefined;
8081
}
8182
const gridContainerRef = useRef<HTMLDivElement>(null);
83+
const [refreshkey, setRefreshKey] = useState(0);
8284
const refreshGrid = () => {
8385
if (gridContainerRef.current) {
8486
while (gridContainerRef.current.firstChild) {
@@ -87,6 +89,7 @@ const ResultGrid = forwardRef<ResultGridHandle, ResultGridProps>(
8789
);
8890
}
8991
}
92+
setRefreshKey((prev) => prev + 1);
9093
};
9194
const resizeGrid = (width: number, height: number) => {
9295
let gridParent: HTMLElement | null;
@@ -308,7 +311,7 @@ const ResultGrid = forwardRef<ResultGridHandle, ResultGridProps>(
308311
),
309312
);
310313
}
311-
}, []);
314+
}, [refreshkey]);
312315

313316
useImperativeHandle(ref, () => ({
314317
refreshGrid,

0 commit comments

Comments
 (0)