Add per-client localStorage API - #756
Merged
Merged
Conversation
Evanston09
force-pushed
the
local-storage
branch
from
August 6, 2026 20:15
dada1c9 to
c1d0fd4
Compare
Collaborator
|
Thanks @Evanston09! Are you able to share what you're using this for? |
Contributor
Author
|
Hello! I’m building a 5-axis 3D-printer slicer with Viser, and I’d like to persist a few machine-specific settings in the browser across sessions. |
…semantics with get_render Keys written via client.local_storage are namespaced under a "viser-user:" prefix in the browser, and clear() only removes prefixed keys. This prevents a viser server from reading or wiping localStorage state that other applications keep on a shared origin (e.g. several statically-hosted clients under one site). The prefix is applied client-side; the Python API continues to take bare key names. An e2e test covers the isolation behavior. get_item's failure handling now matches get_render(): None strictly means the key is absent, a disconnect is detected promptly (same 0.1s poll against _connected_clients) and raises RuntimeError, blocked storage access raises RuntimeError, and timeout is opt-in -- None (default) waits indefinitely, while a set timeout raises TimeoutError when exceeded.
brentyi
approved these changes
Aug 12, 2026
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.
client.local_storagemethods for reading and writing local storage valuesLocalStorageHandle