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

How to persist state if the default state has not changed? #48

Open
GeoffreyHayward opened this issue Jun 28, 2022 · 0 comments
Open

How to persist state if the default state has not changed? #48

GeoffreyHayward opened this issue Jun 28, 2022 · 0 comments

Comments

@GeoffreyHayward
Copy link

GeoffreyHayward commented Jun 28, 2022

How do I persist the state of a store if the initial default state has not changed? If the defaults are accepted, I don't need to ask for the user's preferences for another 365 days. But I must get the user to accept the defaults before using them.

I am creating a store that starts with everything given a default value. If a user changes any default values, it saves the store to a cookie. However, if the user accepts the default values without changing anything and presses an 'agree' button, the store’s state does not get saved into a cookie. No cookie is created.

I looked at the source and found updateStorage and wondered if that could be used in my component’s agree method. However, updateStorage expects a strategy as its first argument, but I don’t necessarily know the strategy inside a component, and a store could have more than one.

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

1 participant