leva icon indicating copy to clipboard operation
leva copied to clipboard

Serialization & persistance

Open gsimone opened this issue 3 years ago • 6 comments

Users should be able to persist changes or to serialize and saved them

@emmelleppi started doing work for this in use-tweaks

I think this one will be way easier since we can just serialize, unserialize the whole store. Thoughts? @dbismut

gsimone avatar Nov 10 '20 12:11 gsimone

Should be trivial indeed! The only thing is for the button input: I'm not sure you can serialize/unserialize functions?

dbismut avatar Nov 10 '20 12:11 dbismut

Those are declared in the code though, we are only going to save the actual data, right?

gsimone avatar Nov 10 '20 12:11 gsimone

Oh yes sure, in that case that's a two liner. We should also save the settings (like min/max/step) right? Or just the values?

How would we trigger serialization?

dbismut avatar Nov 10 '20 12:11 dbismut

Probably just the values, assuming settings don't change ( or using schema as a key for localstorage? ). Thinking about it, there are some problems where:

  • user serializes state
  • changes tweaks settings/dirs
  • now state and tweaks don't work with eachother ( this happens with theatre js too )

We can forget about it for now 🤷‍♂️

RE: Probably make it configurable via the useTwixSettings hook we thought about ( #13 )

gsimone avatar Nov 10 '20 12:11 gsimone

Is there a way to save the configuration and load it again? How would you do it?

CptCompiler avatar Oct 23 '21 07:10 CptCompiler

Would be great if we could get this functionality added so we can persist settings in localstorage and load the initial settings from a saved state.

We currently use levaStore.set(query) but it causes double renders since components mount with the default settings.

ffdead avatar Feb 02 '22 20:02 ffdead