Reset component state after navigation
I have a page that only includes 1 component (because I reuse it across multiple pages).
However, this leads to unexpected behavior: Whenever I navigate back to the page, it still has the old state.
Is there a way to make sure this state is reset after navigation, without having to manually do this?
ssr is off btw
according to chatgpt, the state should reset between mounts and unmounts, so maybe its a bug?
i currently use
22 Replies
How do you manage your state?
Any chances for minimal repro on Stackblitz?
for example
if user executes:
state.value.foo = 'baz'
and then exits the page
navigating back to the page still has state.foo
set to baz
what can I use as boilerplate?https://nuxt.new/
@Revadike Did you fix it already? You seem very quiet π»
No
Been busy
I cant get it reproduced in a new environment
Here is the relevant code. Maybe you can spot the problem?
It would make sense if I would be coworker in your team. But I don't have time nor motivation to go through so many lines of unfamiliar code to spot something that does not belong there. If you cannot extract the faulty code and make it easy to run and fiddle with on StackBlitz or CodeSandbox, I'm out, sorry.
sure I can add you as collaborator, i appreciate your time and help!
what is your gh username
@J-Sek
invited
I started it locally. Can I reproduce the problem without filling out all the
FIREBASE_*
variables?yeah start the emulators
Not really, but I managed to set them up. Please generate me a new Steam API Key. My account "does not meet the requirements for a developer API key".
Send via DM
Have you tried asking claude?
It's been really good at analyzing spaghetti and spotting potential causees of bugs
sure i'll try
prompt: find bugs plz
π
well, i actually asked chatgpt before and claude is giving me the same suggestions
basically, either reset manually, or force rerender. Neither really work for me.