Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add history stack to store #546

Open
aandronache opened this issue Dec 2, 2021 · 1 comment
Open

Add history stack to store #546

aandronache opened this issue Dec 2, 2021 · 1 comment

Comments

@aandronache
Copy link

aandronache commented Dec 2, 2021

Hi,

We are using connected-react-router in our app and found ourselves in need of an actual history stack saved in the store that would (beside other potential usages) allow us to pass a flag to the history push / replace method in order to skip back a specific number of screens (i.e. we have a "project create" flow that includes 4 different steps; after we finish the last step we do not want the user to reach back to it when clicking on the browser "back" button, he has to start over from step 1).

This could have been implemented locally, by using session storage or something similar and checking the flag when reaching back the last step of the flow, but we wanted a generic way of doing this, as simple as possible, therefore all we need to do right now is to use history.push('url', { skipBack: 4 }) when redirecting away from the last step and the middleware will handle everything when the user tries to go back.

I am wondering if it would be of interest to somehow merge this functionality into this repo so that users can opt-in. I have found a similar package that also uses connected-react-router but it felt a bit too lightweight. For instance, it does not tell us if the last action was 'BACK' or 'FORWARD', it also does not have the skip back/forward functionality implemented and it breaks on page refresh (we are saving the router state in session storage on app unload in order to be able to get it back in case of page reload / manual url change).

I can give you more details if this feels of interest to you, please reach back. I could also make a separate package for this, but felt like I should talk to you first. Also, I'm not sure if I posted this in the right place but I didn't know how to contact you.

Have a nice day!

Screen Shot 2021-12-02 at 15 07 08

@salvoravida
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants