redux-query-sync icon indicating copy to clipboard operation
redux-query-sync copied to clipboard

Clicking back button once cycles through all states and then goes back

Open noahkconley opened this issue 4 years ago • 1 comments

I was under the impression that omitting replaceState from the options would allow the user to cycle back through the selections they made using the back button, and that's sort of happening, but not the way I expected. What's happening is I can see it very quickly cycle through the previous states and then navigate back to the previous page, or if I put in a breakpoint it only cycles back one state.

store setup:

...

    ReduxQuerySync({
      store: this.store,
      initialTruth: 'location',
      params: queryParams
    });

...

queryParams:

import { moveToTab } from 'bundles/project/actions/index';

const queryParams = {
  tab: {
    action: value => moveToTab(value || 'overview'),
    selector: state => state.ui.activeTab,
    defaultValue: 'overview'
  }
};

export default queryParams;

moveToTab action:

export function moveToTab(tab) {
  return { type: MOVE_TO_TAB, tab };
}

I am using combineReducers, not sure if that would have an effect on the library's ability to step back through the previous states.

noahkconley avatar Jun 23 '20 22:06 noahkconley

I was under the impression that omitting replaceState from the options would allow the user to cycle back through the selections they made using the back button

That should indeed be the case.

What's happening is I can see it very quickly cycle through the previous states and then navigate back to the previous page, or if I put in a breakpoint it only cycles back one state.

I have no idea why that happens. Might your code somehow initiate a new navigation? Is your browser overly enthusiastic? I hope you already found a solution by now.

Treora avatar Jul 16 '20 14:07 Treora