-
Notifications
You must be signed in to change notification settings - Fork 10
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
Proposal: useObjectStore Hook #16
Comments
hi @SKaplanOfficial, thanks for the thorough proposal! I agree that it would be nice to have a hook to abstract away a bunch of the details interact To that end, though, I wonder if you'd be open to a simpler approach? 😅 It looks like the problems this hook tries to address would be equally solved by a What do you think? |
Hey @sxn, I think In the example I gave, Perhaps |
hey @SKaplanOfficial, you're right. it just sounds like maybe a too specific problem for a general-purpose toolset.
This sounds sensible, yeah. I'm aware of raycast-toolkit already, there's no reason it couldn't be extended, or have another library to cover more specific use cases. |
Summary: A hook to simplify the creation and management of object dictionaries in LocalStorage, with a simple interface for CRUD operations. This would be useful for storing objects that populate List and Grid views, for example.
Details: This hook would create a LocalStorage entry containing a dictionary of objects as a JSON string, and it would provide easy access to methods for accessing, removing, and updating objects, as well as for performing object key migrations and batch-adding of new keys. A cached option could be provided.
Quite a few extensions store objects in this way and would benefit from a dedicated implementation, especially one that supports future development by providing methods for migrations (since the need/want to rename or delete keys is often unforeseen). Moreover, a standard implementation would allow additional features going forward, e.g. an option to use a JSON file in the extension's support directory rather than in LocalStorage, with minimal changes in extensions' code.
I'd be happy to work on this if there's support for it.
Proposed Interface:
Example:
The text was updated successfully, but these errors were encountered: