Persistent Variables 🤔

Alright, this might be a bit out there, but hear me out—I think you'll appreciate where I'm coming from: what if variables could be made persistent?

I know, traditionally, variables are tied to the application lifecycle - and persistence is not built-in by design. When an app reloads, variables reset to their default values, which makes sense. - But what if we had the option to make specific variables persistent, even after a reload? A variable could be globally persistent, meaning any change by one user would update it for everyone, in real-time.

Now, let’s take it a step further. What if persistence wasn’t used shared across all users, but optionally per user? Imagine a scenario where a user updates a variable, and they continue seeing that value next time they use the app—while other users would still see their own defaults or updated values.

At this point, you might be thinking, “Isn’t that just a database?” And yes, in some ways, it is. But this approach could be far more accessible, removing much of the complexity of database design. Unlike localStorage, which is isolated per user and has limitations, this would allow seamless sharing of state across sessions and even users.

As a bonus :gift:, imagine the editor view providing an overview all variables and their values per user. That could be helpful for insights, debugging, fine-tuning, or collaborative applications.

I'm curipus to what y'all think. Should variables stay the way they are, or would you be open to a more persistent approach?

I would love to hear your opinion! :wave:

1 Like

I really like how you explained this, and couldn't agree more.

Imagine a scenario where a user updates a variable, and they continue seeing that value next time they use the app—while other users would still see their own defaults or updated values.

Yup, I constantly use localStorage to somehow achieve this.

Unlike localStorage , which is isolated per user and has limitations, this would allow seamless sharing of state across sessions and even users.

I like the idea, but struggle to identify use cases, other than an admin personalizing how an app looks for all users. What use cases do you have in mind?

The other challenge would be for retool accounts with a multitenancy approach (which I know is not what retool is designed for, but hey here we are anyway). My apps retrieve data via RLS using user attributes as filters. I can immagine how complex would be to set up globally persistent variables that are segmented for each tenant.

2 Likes

I'm glad you see potential in this! :wink: I have to admit, it's a bit out there, but as with many abstract ideas, it's often only after they become feasible that people start using them in unexpected ways.

One possible use case that comes to mind is user settings. While I have something different in mind for my own project, this would likely be the first application that springs to mind. Another example could be an admin dashboard where users can customize the order or visibility of certain panels—or even something as simple as toggling table columns. I know these features can be handled with Local Storage, but I was curious whether this might leverage variables in new ways.

Thanks for the feature request! I don't believe this is on our roadmap, but I can request it.

The use cases are helpful, as I could see us shipping certain features like, allowing users to customize the order or visibility of certain panels, separate from shipping generic persistent variables (though custom visibility is not necessarily on the roadmap yet either)

1 Like

Thanks for your response. I realize this may be one of the largest (and perhaps most controversial) feature requests I have submitted thus far, but I think it might touch on something far greater; Perhaps a store or a simple way of storing data alongside variables and components. Who knows what that may turn into.... :thinking: