Skip to content

Commit 2af2961

Browse files
committed
fix: should not cache data
1 parent d358294 commit 2af2961

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/components/PaginatedTable/PaginatedTable.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface PaginatedTableProps<T, F> {
3838
renderErrorMessage?: RenderErrorMessage;
3939
containerClassName?: string;
4040
onDataFetched?: (data: PaginatedTableData<T>) => void;
41+
keepCache?: boolean;
4142
}
4243

4344
const DEFAULT_PAGINATION_LIMIT = 20;
@@ -59,6 +60,7 @@ export const PaginatedTable = <T, F>({
5960
renderEmptyDataMessage,
6061
containerClassName,
6162
onDataFetched,
63+
keepCache = true,
6264
}: PaginatedTableProps<T, F>) => {
6365
const initialTotal = initialEntitiesCount || 0;
6466
const initialFound = initialEntitiesCount || 1;
@@ -134,6 +136,7 @@ export const PaginatedTable = <T, F>({
134136
renderEmptyDataMessage={renderEmptyDataMessage}
135137
onDataFetched={handleDataFetched}
136138
isActive={isActive}
139+
keepCache={keepCache}
137140
/>
138141
));
139142
};

src/components/PaginatedTable/TableChunk.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ interface TableChunkProps<T, F> {
3737
renderErrorMessage?: RenderErrorMessage;
3838
renderEmptyDataMessage?: RenderEmptyDataMessage;
3939
onDataFetched: (data?: PaginatedTableData<T>) => void;
40+
41+
keepCache?: boolean;
4042
}
4143

4244
// Memoisation prevents chunks rerenders that could cause perfomance issues on big tables
@@ -55,6 +57,7 @@ export const TableChunk = typedMemo(function TableChunk<T, F>({
5557
renderEmptyDataMessage,
5658
onDataFetched,
5759
isActive,
60+
keepCache,
5861
}: TableChunkProps<T, F>) {
5962
const [isTimeoutActive, setIsTimeoutActive] = React.useState(true);
6063
const [autoRefreshInterval] = useAutoRefreshInterval();
@@ -74,6 +77,7 @@ export const TableChunk = typedMemo(function TableChunk<T, F>({
7477
tableDataApi.useFetchTableChunkQuery(queryParams, {
7578
skip: isTimeoutActive || !isActive,
7679
pollingInterval: autoRefreshInterval,
80+
refetchOnMountOrArgChange: !keepCache,
7781
});
7882

7983
const {currentData, error} = tableDataApi.endpoints.fetchTableChunk.useQueryState(queryParams);

src/containers/Tenant/Diagnostics/TopicData/TopicData.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ export function TopicData({parentRef, path, database}: TopicDataProps) {
257257
filters={tableFilters}
258258
tableName="topicData"
259259
rowHeight={DEFAULT_TABLE_ROW_HEIGHT}
260+
keepCache={false}
260261
/>
261262
)}
262263
</React.Fragment>

0 commit comments

Comments
 (0)