It would be very useful to have an option to use an update method for local storage. I have a similar situation in several apps where I store large JSON files in local storage and need to update only one value somewhere inside. Currently, I copy the object from local storage, update the value, and save it back (using the setValue method) to local storage. Unfortunately, this approach has some drawbacks, especially when a user quickly triggers actions that initiate such updates in multiple places. An update method with a signature like update(key:, newValue:, path:) would likely solve these issues.
Ah. Got it. I tend to create variables instead of using local storage, so my mind went there instead of thinking about the differences. Makes sense to me to add a setIn() function for local storage.
I can definitely make a request to see if our engineering team can add the function that would do the same thing as setIn but for local storage.
Because local storage is a part of the browser, this may be outside the scope of Retool's capabilities but it doesn't hurt to ask.
As @jg80 eloquently points out, Retool variables can be used in the exact same way to save data in a from end 'state' and already has the setIn method for being able to quickly and efficiently find a value by a key and replace its value with the new data passed in as a function arg.
Ah interesting, have you tried using multipage apps? That might be easier to pass data between the pages instead of having to move data across separate apps
It's not just for apps; it's also useful when working with modules that update data. You don’t need to pass out any parameters or merge data in any way. I have solutions based on local storage that were created before multipage apps were introduced, and everything works as expected.
Will keep you updated on any news for the feature request to add in a method for quick insert to local storage.
I would imagine that this could be done as a custom JS Query block but might be complex and if we can have a built in tool that is reusable for all users that would definitely help with such use cases.