2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-07 06:00:57 +00:00

Bug fix for build output table (#9946)

- Ensure records are cleared after bulk operation
This commit is contained in:
Oliver
2025-07-03 13:32:41 +10:00
committed by GitHub
parent ee3a574029
commit ededeeee00
3 changed files with 13 additions and 7 deletions

View File

@ -37,7 +37,7 @@ import type { FilterSetState } from './Filters';
*/ */
export type TableState = { export type TableState = {
tableKey: string; tableKey: string;
refreshTable: () => void; refreshTable: (clearSelected?: boolean) => void;
isLoading: boolean; isLoading: boolean;
setIsLoading: (value: boolean) => void; setIsLoading: (value: boolean) => void;
filterSet: FilterSetState; filterSet: FilterSetState;

View File

@ -28,9 +28,15 @@ export function useTable(tableName: string, idAccessor = 'pk'): TableState {
const [tableKey, setTableKey] = useState<string>(generateTableName()); const [tableKey, setTableKey] = useState<string>(generateTableName());
// Callback used to refresh (reload) the table // Callback used to refresh (reload) the table
const refreshTable = useCallback(() => { const refreshTable = useCallback(
setTableKey(generateTableName()); (clearSelection?: boolean) => {
}, [generateTableName]); setTableKey(generateTableName());
if (clearSelection) {
clearSelectedRecords();
}
},
[generateTableName]
);
const filterSet: FilterSetState = useFilterSet(`table-${tableName}`); const filterSet: FilterSetState = useFilterSet(`table-${tableName}`);

View File

@ -286,7 +286,7 @@ export default function BuildOutputTable({
build: build, build: build,
outputs: selectedOutputs, outputs: selectedOutputs,
onFormSuccess: () => { onFormSuccess: () => {
table.refreshTable(); table.refreshTable(true);
refreshBuild(); refreshBuild();
} }
}); });
@ -295,7 +295,7 @@ export default function BuildOutputTable({
build: build, build: build,
outputs: selectedOutputs, outputs: selectedOutputs,
onFormSuccess: () => { onFormSuccess: () => {
table.refreshTable(); table.refreshTable(true);
refreshBuild(); refreshBuild();
} }
}); });
@ -304,7 +304,7 @@ export default function BuildOutputTable({
build: build, build: build,
outputs: selectedOutputs, outputs: selectedOutputs,
onFormSuccess: () => { onFormSuccess: () => {
table.refreshTable(); table.refreshTable(true);
refreshBuild(); refreshBuild();
} }
}); });