From a27d0ffb498c296a521484e49b27b9bffb25e314 Mon Sep 17 00:00:00 2001 From: Kairsten Fay Date: Tue, 28 Jan 2020 17:17:39 -0800 Subject: [PATCH] narratives: Rename negative boolean variable Rename the `dontChangeDataset` variable to `changeDataset` for code that's easier to read and comprehend. Inverse the boolean logic accordingly. --- src/actions/navigation.js | 4 ++-- src/components/narrative/MobileNarrativeDisplay.js | 2 +- src/components/narrative/index.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/actions/navigation.js b/src/actions/navigation.js index c179932bf..d8db05ae3 100644 --- a/src/actions/navigation.js +++ b/src/actions/navigation.js @@ -46,7 +46,7 @@ export const changePage = ({ query = undefined, queryToDisplay = undefined, /* doesn't affect state, only URL. defaults to query unless specified */ push = true, - dontChangeDataset = false + changeDataset = true } = {}) => (dispatch, getState) => { const oldState = getState(); // console.warn("CHANGE PAGE!", path, query, queryToDisplay, push); @@ -58,7 +58,7 @@ export const changePage = ({ /* some booleans */ const pathHasChanged = oldState.general.pathname !== path; - if (!dontChangeDataset || pathHasChanged) { + if (changeDataset || pathHasChanged) { const action = { type: PAGE_CHANGE, path, diff --git a/src/components/narrative/MobileNarrativeDisplay.js b/src/components/narrative/MobileNarrativeDisplay.js index 07881170c..5ee10a34f 100644 --- a/src/components/narrative/MobileNarrativeDisplay.js +++ b/src/components/narrative/MobileNarrativeDisplay.js @@ -53,7 +53,7 @@ class MobileNarrativeDisplay extends React.Component { return; } this.props.dispatch(changePage({ - dontChangeDataset: true, + changeDataset: false, query: queryString.parse(this.props.blocks[idx].query), queryToDisplay: {n: idx}, push: true diff --git a/src/components/narrative/index.js b/src/components/narrative/index.js index 43c3f3635..27b8d9b81 100644 --- a/src/components/narrative/index.js +++ b/src/components/narrative/index.js @@ -47,7 +47,7 @@ class Narrative extends React.Component { this.props.dispatch(changePage({ // path: this.props.blocks[blockIdx].dataset, // not yet implemented properly - dontChangeDataset: true, + changeDataset: false, query: queryString.parse(this.props.blocks[idx].query), queryToDisplay: {n: idx}, push: true