[MainUI] Enable server pinia storage#4267
Draft
Nadahar wants to merge 1 commit into
Draft
Conversation
Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
Contributor
Author
|
By the way, I have no idea why it reformatted the whole |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This doesn't do anything useful at the moment, it's more of a "sketch" of what I'm thinking of.
I got the idea when looking at #4196, I think it can be very useful, but also think that the fact that you must repeat in on every browser on every device kind of undermines the usefulness.
The idea here is that it will be stored per logged-in user instead. Most people probably only have one OH user, but it is possible to have more if that is desirable. Not all pinia stores are suitable for server/user storage, so my idea is to make a general way to easily facilitate either local browser storage or server storage per pinia store.
This is what I've managed to come up with, with heavy assistance by "AI". I don't know if this is the most reasonable way to organize it, but I think it serves to present the idea: That a pinia plugin handles the actual storage, and that each store only has to specify
localorserverwhen they are created, and the rest is handled transparently.In addition, the stores have gotten a
readyproperty, that can be used when determining if the page is loaded, so that the placeholder skeleton will stay in place until the store has been populated as well.Endpoints for storage and retrieval would have to be created in core, and it would also have to be figured out exactly how to handle the per-user storage. When it comes to the store itself, it's just a JSON object, so I was imagining to treat it like a simple string in core - so that core don't actually interfere with the store data at all (if it's not parsed/understood, there can be no manipulation/changes)
I think I can make the core part relatively easily, but I won't start that unless you guys think it's something worth pursuing. So, @florian-h05 and @jsjames, what do you think of the idea, not so much the implementation?