You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
I am working on a project where the data is store on a user's local machine. Over time I want to add additional settings however I'm finding that recoil/refine/recoil-sync are not filling in undefined keys on the object. For example:
In this example, the initial state works. The user can toggle between the seconds. Lets say now I want to add showMeridiem (AM/PM). The problem is if I just add it in the type, refine, and in the default value, my code starts to throw because it's missing. I'm looking for a way to automatically merge the data with the defaults if it doesn't exist. I could wrap everything with withDefault, but the problem is I have to wrap every single item I add with it and makes the entire refine messy.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hello,
I am working on a project where the data is store on a user's local machine. Over time I want to add additional settings however I'm finding that recoil/refine/recoil-sync are not filling in
undefined
keys on the object. For example:In this example, the initial state works. The user can toggle between the seconds. Lets say now I want to add
showMeridiem
(AM/PM). The problem is if I just add it in the type,refine
, and in the default value, my code starts to throw because it's missing. I'm looking for a way to automatically merge the data with the defaults if it doesn't exist. I could wrap everything withwithDefault
, but the problem is I have to wrap every single item I add with it and makes the entirerefine
messy.Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions