intendednull / yewdux

Ergonomic state management for Yew applications
https://intendednull.github.io/yewdux/
Apache License 2.0
322 stars 31 forks source link

It seems yewdux not working on safari #50

Closed betta-cyber closed 1 year ago

betta-cyber commented 1 year ago

my code like this:

let (store, dispatch) = use_store::<Store>();
let user = store.auth_user.clone();
console_log!("{:#?}", user);
#[derive(Debug, Serialize, Deserialize, Default, Clone, PartialEq, Store)]
#[store(storage = "local", storage_tab_sync)]
pub struct Store {
    pub auth_user: Option<User>,
    pub page_loading: bool,
    pub alert_input: AlertInput,
}

pub fn set_auth_user(user: Option<User>, dispatch: Dispatch<Store>) {
    dispatch.reduce_mut(move |store| {
        store.auth_user = user;
    })
}

When i use Chrome, console log show:

截屏2023-03-09 下午3 59 35

When i use safari, console log show always None :

截屏2023-03-09 下午4 02 31

Maybe storage_tab_sync ? or other problem ?

betta-cyber commented 1 year ago

I'm sorry, it's my code logic problem.