Skip to content

Commit

Permalink
Fix bug in narratives with filter changes
Browse files Browse the repository at this point in the history
When we constructed the initial controls state we essentially did
```
controls.defaults = {
    filters: {}
},
controls.filters = controls.defaults.filters
```
and thus changing the current filter would also change the default. For
narratives we need to be able to reset the default state, and since each
value pointed to the same reference we ended up keeping the current
state.
  • Loading branch information
jameshadfield committed Nov 4, 2024
1 parent 35e4ca6 commit e3cfb27
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/reducers/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ export const getDefaultControlsState = () => {
canRenderBranchLabels: true,
analysisSlider: false,
geoResolution: defaults.geoResolution,
filters: defaults.filters,
filtersInFooter: defaults.filtersInFooter,
filters: JSON.parse(JSON.stringify(defaults.filters)),
filtersInFooter: JSON.parse(JSON.stringify(defaults.filtersInFooter)),
modal: null,
quickdraw: false, // if true, components may skip expensive computes.
mapAnimationDurationInMilliseconds: 30000, // in milliseconds
Expand Down

0 comments on commit e3cfb27

Please sign in to comment.