Commit 09aa15d 1 parent 59a957c commit 09aa15d Copy full SHA for 09aa15d
File tree 2 files changed +31
-19
lines changed
pages/destructionlist/review
2 files changed +31
-19
lines changed Original file line number Diff line number Diff line change @@ -457,7 +457,9 @@ export function useZaakSelection<T = unknown>(
457
457
zaakSelectionOnPage : optimisticSelection as ZaakSelection < T > ,
458
458
handleSelectAllPages : onSelectAllPages ,
459
459
clearZaakSelection : clearZaakSelection ,
460
- revalidateZaakSelection : ( ) => setRevalidateCount ( revalidateCount + 1 ) ,
460
+ revalidateZaakSelection : ( ) => {
461
+ setRevalidateCount ( revalidateCount + 1 ) ;
462
+ } ,
461
463
} ,
462
464
] ;
463
465
}
Original file line number Diff line number Diff line change @@ -45,6 +45,11 @@ import { DestructionListReviewContext } from "./DestructionListReview.loader";
45
45
export const getDestructionListReviewKey = ( id : string , status : string ) =>
46
46
`destruction-list-review-${ id } -${ status } ` ;
47
47
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
+
48
53
/**
49
54
* Review-destruction-list page
50
55
*/
@@ -93,25 +98,30 @@ export function DestructionListReviewPage() {
93
98
94
99
// Poll for changes, update selection if a (remote) change has been made (by
95
100
// 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
+ ) ;
106
112
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
+ ) ;
115
125
116
126
// Get zaak selection for approved zaken.
117
127
const approvedZaakSelection : ZaakSelection < {
You can’t perform that action at this time.
0 commit comments