Skip to content

Commit 09aa15d

Browse files
🐛 - fix: fix broken co review
1 parent 59a957c commit 09aa15d

File tree

2 files changed

+31
-19
lines changed

2 files changed

+31
-19
lines changed

frontend/src/hooks/useZaakSelection.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,9 @@ export function useZaakSelection<T = unknown>(
457457
zaakSelectionOnPage: optimisticSelection as ZaakSelection<T>,
458458
handleSelectAllPages: onSelectAllPages,
459459
clearZaakSelection: clearZaakSelection,
460-
revalidateZaakSelection: () => setRevalidateCount(revalidateCount + 1),
460+
revalidateZaakSelection: () => {
461+
setRevalidateCount(revalidateCount + 1);
462+
},
461463
},
462464
];
463465
}

frontend/src/pages/destructionlist/review/DestructionListReview.tsx

+28-18
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ import { DestructionListReviewContext } from "./DestructionListReview.loader";
4545
export const getDestructionListReviewKey = (id: string, status: string) =>
4646
`destruction-list-review-${id}-${status}`;
4747

48+
/** The maximum default cache age. */
49+
export const CO_REVIEW_POLL_INTERVAL = parseInt(
50+
import.meta.env.OAB_CO_REVIEW_POLL_INTERVAL || 3000,
51+
);
52+
4853
/**
4954
* Review-destruction-list page
5055
*/
@@ -93,25 +98,30 @@ export function DestructionListReviewPage() {
9398

9499
// Poll for changes, update selection if a (remote) change has been made (by
95100
// another reviewer).
96-
usePoll(async () => {
97-
const pollZaakSelection = await getZaakSelectionItems<{
98-
approved: boolean;
99-
comment: string;
100-
}>(
101-
storageKey,
102-
zakenResults.map((zaak) => zaak.url as string),
103-
true,
104-
RestBackend,
105-
);
101+
usePoll(
102+
async () => {
103+
const pollZaakSelection = await getZaakSelectionItems<{
104+
approved: boolean;
105+
comment: string;
106+
}>(
107+
storageKey,
108+
zakenResults.map((zaak) => zaak.url as string),
109+
true,
110+
RestBackend,
111+
);
106112

107-
const hasChanged = !compareZaakSelection(
108-
pollZaakSelection,
109-
zaakSelectionOnPage,
110-
);
111-
if (hasChanged) {
112-
revalidateZaakSelection();
113-
}
114-
});
113+
const hasChanged = !compareZaakSelection(
114+
pollZaakSelection,
115+
zaakSelectionOnPage,
116+
);
117+
118+
if (hasChanged) {
119+
revalidateZaakSelection();
120+
}
121+
},
122+
[zaakSelectionOnPage],
123+
{ timeout: CO_REVIEW_POLL_INTERVAL },
124+
);
115125

116126
// Get zaak selection for approved zaken.
117127
const approvedZaakSelection: ZaakSelection<{

0 commit comments

Comments
 (0)