Save/resume state via query params -- seeking implementation guidance, possible contribution #522
bryantcodesart
started this conversation in
Ideas
Replies: 1 comment
-
Saving this snippet here as it seems relevant to anybody wanting to make a hook wrapper that would add onChange When I write a decent recipe for this pattern--probably built on that foundation--I'll place it here. This discussion is, in general, related to external store synchronization conversations e.g. #184 I suppose! As we can consider the URL params--or some abstraction around them--to be an external store. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a homebaked R+D workflow with designers where any changes to my customization controls will be added to query params in the URL. The controls defer to the params on load for resumability.
This way designers can easily save/share variations and settings of the prototype. This has greatly accelerated iteration pace at the creative agencies where I contract! (Especially on projects with dozens and dozens of tightly-dependent controls.)
E.g. Designer: "My favorite version is
url
. Can those be defaults?" "Something interesting happens aturl
, can we explore that?" "I really want to avoid whats happening hereurl
"Dev: "I made a prototype that accommodates the 3 possible directions we are considering. Here are the landmarks:
url
,url
,url
." (I often prefer this to branching the code during a prototype stage.)I switched to leva from my homemade controls and LOVE it.
Began looking for the best way to have my url params workflow with Leva. Searched for quite some time. Didn't see anything ootb. (Although the storybook has a caching example that seems related.) Did I miss something obvious?
I thought about doing so with a custom wrapper hook e.g. useUrlControls--but paused considering how to handle folders. Is this better done with a plugin?
If I'm not stupid and it already exists. Im gonna build this for myself regardless. If there's approach that turns that into a useful contribution or example--Id love to do it that way!
Beta Was this translation helpful? Give feedback.
All reactions