Navigating between routes containing Leva panels with a same-name field uses stale data #480
-
Hello @dbismut , I'm encountering a problem that I'm pretty sure is easy to fix but my lack of experience is impeding me to. I have a /components route in my website, When I navigate between different routes, say I move from I am sorry for my dumbness but I really can't figure it out, I'd be happy to contribute to the docs if needed, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Could you please provide a sandbox? I'll try to fix it for you when I have time. |
Beta Was this translation helpful? Give feedback.
-
Sure, thank you! Here's the sandbox: https://codesandbox.io/p/sandbox/bold-estrela-4cl2r7 It's next 14 with only Leva as a dependency. In these routes I use So, the "symptoms" are:
if you refresh, you'll see the rectangle resetting to the correct width. but then if you client side navigate to So basically it's something about client side navigation, but for all I know it might be me ignoring a specific property I ought to use :) the sandbox should have everything you need to understand the behaviour, every navigation link is client-side so just have fun with it and check the rectangle's width Thank you so much for your help |
Beta Was this translation helpful? Give feedback.
Hey, moving this to a discussion since it's not a bug.
I'm getting an error when navigating to each of the routes.
However I understand the issue.
A few things to note:
width
) in two different places, Leva will only create one input, and will set its initial value to the value define in theuseControls
hook being called first.Luckily for you, Leva also allows you to create several stores and dynamically assign a store to a panel. This sandbox from the demo p…