Skip to content

Commit

Permalink
avoid null issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mapmeld committed Nov 11, 2024
1 parent 11ad326 commit e11426a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/src/app/store/mapStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,12 @@ export const useMapStore = create(
),
{
diff: (pastState: Partial<MapStore>, currentState: Partial<MapStore>) => {
currentState.zoneAssignments.keys().forEach((geoid) => {
if (!currentState.zoneAssignments || !pastState.zoneAssignments) return pastState;
for (const geoid of currentState.zoneAssignments.keys()) {
if (!pastState.zoneAssignments.has(geoid)) {
pastState.zoneAssignments.set(geoid, null);
}
});
}
return pastState as Partial<MapStore>;
},
equality: (pastState, currentState) => {
Expand Down

0 comments on commit e11426a

Please sign in to comment.