Skip to content

Commit 7847534

Browse files
Xaohssvenvandescheur
authored andcommitted
👌 - fix: fixed global field selection
1 parent fca0a62 commit 7847534

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

frontend/src/pages/constants.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,5 @@ export const PROCESSING_STATUS_LEVEL_MAPPING: {
7575
failed: "danger",
7676
succeeded: "success",
7777
};
78+
79+
export const FIELD_SELECTION_STORAGE_KEY = "field-selection-list";

frontend/src/pages/destructionlist/hooks/useDataGridProps.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import {
2929
removeFromZaakSelection,
3030
} from "../../../lib/zaakSelection/zaakSelection";
3131
import { ExpandZaak, Zaak } from "../../../types";
32+
import { FIELD_SELECTION_STORAGE_KEY } from "../../constants";
3233

3334
/** The template used to format urls to an external application providing zaak details. */
3435
const REACT_APP_ZAAK_URL_TEMPLATE = process.env.REACT_APP_ZAAK_URL_TEMPLATE;
@@ -90,7 +91,7 @@ export function useDataGridProps(
9091
const [fieldSelectionState, setFieldSelectionState] =
9192
useState<FieldSelection>();
9293
useEffect(() => {
93-
getFieldSelection(storageKey).then((fieldSelection) =>
94+
getFieldSelection(FIELD_SELECTION_STORAGE_KEY).then((fieldSelection) =>
9495
setFieldSelectionState(fieldSelection),
9596
);
9697
}, []);
@@ -191,9 +192,9 @@ export function useDataGridProps(
191192
const onFieldsChange = async (fields: TypedField[]) => {
192193
const activeFields = fields.filter((f) => f.active !== false);
193194
const inActiveFields = fields.filter((f) => f.active === false);
194-
await addToFieldSelection(storageKey, activeFields);
195-
await removeFromFieldSelection(storageKey, inActiveFields);
196-
const fieldSelection = await getFieldSelection(storageKey);
195+
await addToFieldSelection(FIELD_SELECTION_STORAGE_KEY, activeFields);
196+
await removeFromFieldSelection(FIELD_SELECTION_STORAGE_KEY, inActiveFields);
197+
const fieldSelection = await getFieldSelection(FIELD_SELECTION_STORAGE_KEY);
197198
setFieldSelectionState(fieldSelection);
198199
};
199200

0 commit comments

Comments
 (0)