clear tags and categories when switching to narrative

This commit is contained in:
Lachlan Kermode
2019-02-14 15:40:38 +00:00
parent 0758a0d56e
commit 7463aa33ca
2 changed files with 14 additions and 1 deletions

View File

@@ -76,7 +76,11 @@ class Dashboard extends React.Component {
setNarrative (narrative) {
// only handleSelect if narrative is not null
if (narrative) { this.handleSelect([ narrative.steps[0] ]) }
if (narrative) {
this.props.actions.clearFilter('tags')
this.props.actions.clearFilter('categories')
this.handleSelect([ narrative.steps[0] ])
}
this.props.actions.updateNarrative(narrative)
}

View File

@@ -144,6 +144,15 @@ function toggleFilter (appState, action) {
}
}
function clearFilter (appState, action) {
return {
...appState,
filters: {
...appState.filters,
[action.filter]: []
}
}
}
function updateTimeRange (appState, action) { // XXX
return {