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

Keep global state? #1

Closed
jlev opened this issue Sep 4, 2020 · 3 comments
Closed

Keep global state? #1

jlev opened this issue Sep 4, 2020 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jlev
Copy link
Member

jlev commented Sep 4, 2020

Currently using component-level state and hooks for the form, and getting weird effects if someone goes back/forward or clicks to internal links and then back to form. Consider Redux

@jlev jlev added enhancement New feature or request help wanted Extra attention is needed labels Sep 4, 2020
@camdenlee
Copy link
Contributor

@jlev I can take this on. Can you point me to the areas in the application you'd want to use global state? I did a quick search for useState and found a few items, but all of them might not necessitate global state.

This might not need the complexity of Redux and React Context could do the trick instead. Do you have a strong preference?

@jlev
Copy link
Member Author

jlev commented Sep 14, 2020

Thanks @camdenlee! The form has a context provider in https://github.com/spacedogXYZ/crush2020/blob/master/src/components/form/context.js, which is used in the PlanForm component. That's pretty close to redux style (reducers, etc), and works to keep track of user state when they progress normally through the flow.

But, I'm seeing some weird issues when someone navigates away from the form (to eg, Methodology) and then back. Progress is lost, which is not a deal breaker but isn't a great experience. The worst problem is that when you reload a form step (even the first one), it renders with a broken layout which doesn't make sense to me...

  • After navigating to form/vote directly

Screen Shot 2020-09-14 at 9 38 57 AM

  • After starting to fill out the form and then reloading

Screen Shot 2020-09-14 at 9 39 13 AM

@jlev
Copy link
Member Author

jlev commented Sep 17, 2020

Fixed with #19

@jlev jlev closed this as completed Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants