Skip to content

Commit

Permalink
narratives: Rename negative boolean variable
Browse files Browse the repository at this point in the history
Rename the `dontChangeDataset` variable to `changeDataset` for code
that's easier to read and comprehend. Inverse the boolean logic
accordingly.
  • Loading branch information
kairstenfay committed Jan 29, 2020
1 parent 7f8bc52 commit a27d0ff
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/actions/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/components/narrative/MobileNarrativeDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/components/narrative/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a27d0ff

Please sign in to comment.