Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to clear storage #2641

Closed
Mathmagician8191 opened this issue Jan 28, 2023 · 0 comments · Fixed by #3299
Closed

Add a way to clear storage #2641

Mathmagician8191 opened this issue Jan 28, 2023 · 0 comments · Fixed by #3299
Labels
feature New feature or request

Comments

@Mathmagician8191
Copy link

Describe the problem
I have an app where the App.save() function only saves config parameters that are modified from their default.
This allows for people to get the updated value if the default changes, without manually setting the new default or manually clearing the storage.
I have added functionality to reset all the config parameters to their default value, causing the App.save() method to no longer set their values.
Despite this, the keys and values persist in the app.ron after closing the app and get loaded again when relaunching.
Older parameters that I no longer save or load are also persist in the app.ron, which takes up extra storage space.
The documentation mentions no way to clear the storage or reset a specific key.

Describe the solution you'd like
One way to fix this would be to only save keys set by the most recent call to App.save(). This would automatically clean up removed parameters and easily allow for clearing the storage by just not saving any keys.
The downside of this solution is that it is not backwards compatible with some apps e.g. ones that only set their configuration when it has changed since the last save. This could be addressed by using a feature to toggle between the current functionality and the new functionality.

Another way to fix this would be to add a function to clear all the keys in the storage, and/or a function to clear a specific key. This still has the problem of leaving older parameters around unless completely clearing the storage, but preserves backwards compatibility with existing apps.

Describe alternatives you've considered
One alternative would be using a specific string to mark a default value, however this adds complexity to parsing, takes up more storage space, and still leaves obsolete parameters stored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant