Skip to content

Commit

Permalink
Merge pull request #2419 from zetkin/undocumented/load-places-on-sync
Browse files Browse the repository at this point in the history
Set list of places as "stale" when running "sync" function.
  • Loading branch information
ziggabyte authored Dec 9, 2024
2 parents 0e8be00 + 21f79c9 commit 9f69df8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/features/canvassAssignments/hooks/useSidebarStats.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { loadListIfNecessary } from 'core/caching/cacheUtils';
import { useApiClient, useAppDispatch, useAppSelector } from 'core/hooks';
import {
placesInvalidated,
placesLoad,
placesLoaded,
visitsInvalidated,
Expand Down Expand Up @@ -134,6 +135,7 @@ export default function useSidebarStats(
stats,
sync: () => {
dispatch(visitsInvalidated(assignmentId));
dispatch(placesInvalidated());
},
synced: visitList?.loaded || null,
};
Expand Down
4 changes: 4 additions & 0 deletions src/features/canvassAssignments/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ const canvassAssignmentSlice = createSlice({
item.data = place;
item.loaded = new Date().toISOString();
},
placesInvalidated: (state) => {
state.placeList.isStale = true;
},
placesLoad: (state) => {
state.placeList.isLoading = true;
},
Expand Down Expand Up @@ -361,6 +364,7 @@ export const {
canvassSessionsLoad,
canvassSessionsLoaded,
placeCreated,
placesInvalidated,
placesLoad,
placesLoaded,
placeUpdated,
Expand Down

0 comments on commit 9f69df8

Please sign in to comment.