Skip to content

[MainUI] Enable server pinia storage#4267

Draft
Nadahar wants to merge 1 commit into
openhab:mainfrom
Nadahar:pinia
Draft

[MainUI] Enable server pinia storage#4267
Nadahar wants to merge 1 commit into
openhab:mainfrom
Nadahar:pinia

Conversation

@Nadahar

@Nadahar Nadahar commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

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 local or server when they are created, and the rest is handled transparently.

In addition, the stores have gotten a ready property, 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?

Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
@Nadahar

Nadahar commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

By the way, I have no idea why it reformatted the whole useUIOptionsStore.ts. All I actually changed there was to add the persistTo: 'local' as a third parameter, but when I ran the formatter, it completely rearranged the file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant