Clientside callback doesn't change the session data

hello,
I want to add some key/value to session data using client side callback and then use that session data in normal callback. The problem is I can see the added key/value in browser session but when I use them in page callback got key error.

here is my clientside callback:

clientside_callback(
“”"
function disableNewTabClick(data) {
sessionStorage.setItem(‘width’, window.innerWidth);
sessionStorage.setItem(‘height’, window.innerHeight);
}
“”",
Output(“dummy-output”, “data”),
Input(“dummy-input”, “data”),
)

here is browser session:

here callback error:

Hello @AmirK75,

Welcome to the community!

This is due to a syncing issue between the client and React. In order to have React sync, you need to force these to sync somehow.

You could have these saved into a session store object instead of being saved directly into sessionStorage.

unction disableNewTabClick(data) {
    newData = {width: window.innerWidth, height: window.innerHeight};
    return newData;
}
“”",
Output('clientInfo', 'data'),
Input('dummy-input', 'data'),
)

Then your adjusted callback would be:

...
idt = session['idt']
lang = session['lang']
page_wid = session['clientInfo']['width']