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

Encapsulate app state in a Pinia store #2

Merged
merged 2 commits into from
Sep 7, 2023
Merged

Encapsulate app state in a Pinia store #2

merged 2 commits into from
Sep 7, 2023

Conversation

krazkidd
Copy link
Owner

@krazkidd krazkidd commented Sep 7, 2023

This provides reactive app state through a Pinia store and persists preferences to the browser's local storage.

The implementation is a bit of a hack because I couldn't get the state props to be reactive and persisted to local storage under a universal rendering scheme (i.e., with SSR turned on). However, I provide an alternative implementation that may work if Pinia comes to support SSR better. To watch for upstream enhancements, see vuejs/pinia#829.

This is a simpler version but does not work under SSR.
@krazkidd krazkidd self-assigned this Sep 7, 2023
@krazkidd krazkidd merged commit 3e3b76a into main Sep 7, 2023
@krazkidd krazkidd deleted the pinia branch September 7, 2023 22:17
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