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

Persisted State: Extend flexibility #171

Open
huntabyte opened this issue Dec 6, 2024 · 2 comments
Open

Persisted State: Extend flexibility #171

huntabyte opened this issue Dec 6, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@huntabyte
Copy link
Member

huntabyte commented Dec 6, 2024

Describe the feature in detail (code, mocks, or screenshots encouraged)

I want to be able to sync a cookie with local storage without having to think too much about it.

Perhaps exposing callbacks in the options like onChange that users could hook into to do whatever custom logic they want.

--

I also want to be able to provide my own custom storage adapter. This may enable us to avoid the onChange altogether if handled appropriately.

What type of pull request would this be?

Enhancement

Provide relevant links or additional information.

No response

@huntabyte huntabyte added the enhancement New feature or request label Dec 6, 2024
@huntabyte huntabyte changed the title Persisted State: extend flexibility Persisted State: onChange Dec 6, 2024
@huntabyte huntabyte changed the title Persisted State: onChange Persisted State: Extend flexibility Dec 6, 2024
@webJose
Copy link
Contributor

webJose commented Dec 6, 2024

I've been thinking: What about being able to reactively jump from one storage to another? Like I make an app that saves, say, column information such as width, alignment, etc. to storage, but I want the user to be able to select if the data is stored for the "current window session" or "for all sessions". So effectively moving back and forth between storages.

@webJose
Copy link
Contributor

webJose commented Dec 15, 2024

Please have a look at [this comment[(https://github.com//issues/151#issuecomment-2543305186). It proposes the idea of users writing their own storage medium (I guess it can be renamed to storage adapter) to do anything they want whenever a value is read or written. It is a good option to tackle this, if you like the approach, that is.

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

No branches or pull requests

2 participants