Closed tianhuil closed 2 years ago
Wow! Thanks for the big contribution! That's well written and a nice addition. I should admit I have been working on something similar for the library. I would need a little time to review everything. Are you using your fork for now or am I blocking you on some project?
I'm using my fork for now -- but I'd love if it could be merged so that I can get all of your updates. Glad you liked it @astoilkov!
Any interest in merging this @astoilkov?
Hi. I've been working on a storage
option — https://github.com/astoilkov/use-local-storage-state/tree/storage-option. This is something I've been tinkering with for a long time (as I mentioned in my first comment).
I won't merge your pull request but with my implementation, it will be possible to implement the same thing.
It's hard for me to not merge the work of others but I think the storage
option has some benefits:
sessionStorage
(something that has been requested 2 or 3 times before)localStorage
and sessionStorage
and make any kind of synchronous store work. an example would be JSON
file storageAs not merging is something I've done before I am planning on making a Contributing.md file where I explain why and recommend to people to write me before making a contribution.
I'm sorry for the delay. I hope you understand. I'm trying to make my business work and this library is something I do for my love of programming. I'm delaying the work consciously because I should pay my bills first.
My storage option implementation failed. It has too many drawbacks and it's hard to work with. I will be implementing your proposal.
It will take some time because I'm also working on a rewrite for React 18 support. I want to work on the new implementation as well.
I'm ready with the implementation. The new serializer option is mainly inspired by your work. I've merged your work and I thank you.
Note that the new serializer option is only available in the latest release which supports React 18 but not React 17 and below.
Note that the new serializer option is only available in the latest release which supports React 18 but not React 17 and below.
Why is it so though?
The React 18 version is a full rewrite of the React 17 implementation. It was easier to implement this in the new code. If I did bring the feature in React 17, it would have been more than twice the work.
Thanks so much for supporting this! I realized today that my filters were breaking because we were storing Date objects. This solved my woes. 🙌
Awesome to hear this!
Out of curiosity, where are you using the library?
Hi @astoilkov: thanks for this great package! Here is a feature I'm using that I hope we can incorporate!
JSON does not serialize
Date
,Regex
, orBigInt
data. This PR allows users to pass in superjson or otherJSON
-compatible serialization classes for more advanced serialization.See
README.md
andtest.tsx