Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant