-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Hi there, I think I've found a bug. with this minimal example, built for the web platform:
use dioxus::prelude::*;
use dioxus_sdk::storage::*;
fn main() {
dioxus::launch(App);
}
#[component]
fn App() -> Element {
let mut state = use_synced_storage::<LocalStorage, bool>("state".to_string(), || false);
rsx! {
div {
button {
onclick: move |_| {
state.set(!state());
},
"Toggle"
}
if state() {
div {
"State is true"
}
} else {
div {
"State is false"
}
}
}
}
}
The issue:
- load this page in 2 browser windows
- click the button in one of them repeatedly, see the state change in both reliably and in sync
- click the button in the other window a few times, see the state quickly go out of sync
- clicking the button in the first window doesn't sync them up again
I expected both windows to be able to read and write from the local storage entry and see them update in sync. Is this a bug? Should these remain in sync?
Version 0.6.0
michaelmelanson
Metadata
Metadata
Assignees
Labels
No labels