Skip to main content
Shane
Feb 26, 2021 6:30 PM UTC

LAUNCHED: State management for prototypes

Just struck a pretty simple use case/scenario where I need the component to reset it’s state when I leave the frame. This has been touched on elsewhere, but this is such a common and key use that I thought I’d put it in it’s own thread.

Scenario:
I’ve got a dropdown menu with three items in it, with each item changing what columns are visible in a table and some other control states. I have three frames, each with a view of the table setup as it should be, and want to use the dropdown items to navigate between the frames - basically faking the table state change. All of this works perfectly, however when I navigate back to a previous table view state, the dropdown component is already in it’s open state - not what I want.

Current workaround: none that I can come up with (other than not using interactive components at all for this, and just using multiple frames for the dropdown open/closed states as I would previously)

Suggestions:

  1. Have a “reset component on leaving this frame” setting for instances of a component on a frame - useful for this situation and others, but needs to be a setting so that components that should keep their state between frames can do so (light/dark toggle maybe? Something like that).
  2. Do it all in a single frame, with the dropdown component changing the the state of the table component - no frame navigation required. Would work nicely for the particular use case I’m working with here, but not sure it would solve all similar situations.
  3. Do both 1 and 2. This solution is my preferred solution 😉 😆

EDIT:
Other threads that relate:

205 replies

Sanny
New Participant
Dec 8, 2022 11:51 AM UTC

+1 for default state after navigating

Sanny
New Participant
Dec 8, 2022 11:53 AM UTC

+1 for this feature!!!

Court_Crawford
Dec 13, 2022 10:03 PM UTC

+1 for preserving state, but in my case even within an existing frame. Imagine creating a tic-tac-toe board where each cell can be an X, or blank. Once the user clicks on a blank cell and converts it to an X, I also want to navigate to another frame which, after a brief interaction, returns to the frame with the tic-tac-toe board; On returning to the board, I want what just became an X to remain an X and not be a blank again.

Ayoub_El_omri
Dec 14, 2022 9:18 AM UTC

Run into it now. I have a fairly simple setup with a nav menu in the home that can be opened to navigate to deeper routes. Every time I open it and navigate to another page the component will remain open after navigating back to the page.

Piotr_Kocybik
Dec 20, 2022 6:12 PM UTC

I found myself in the same situation, unable to reset a component on interaction.

Lucy_Spence1
Dec 28, 2022 2:32 PM UTC

Similar issue here. Second time an event happens, it hides/rearranges components in a menu system for no apparent reason, and doesn’t reset

Nikita_Chikate
Dec 28, 2022 6:20 PM UTC

resetting component

Francesco_Gramegna
Jan 3, 2023 2:33 PM UTC

+1 For this! 🙏

Marijn
New Member
Jan 20, 2023 10:46 AM UTC

+1 for me.

Diego_Gonzalez_Salcedo1
New Member
Jan 24, 2023 8:38 PM UTC

same here 😪