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 = {
tableKey: string;
refreshTable: () => void;
refreshTable: (clearSelected?: boolean) => void;
isLoading: boolean;
setIsLoading: (value: boolean) => void;
filterSet: FilterSetState;

View File

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

View File

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