Closed CRSilkworth closed 2 months ago
Hi @CRSilkworth
Dash already stringifies the dict ids. Try changing your clientside callback to this (it worked for me :slightly_smiling_face: )
app.clientside_callback(
"""
function(storeId) {
document.addEventListener('keydown', function(event) {
const allowedKeys = ['ArrowLeft', 'ArrowRight', 'Enter'];
if (allowedKeys.includes(event.key)) {
dash_clientside.set_props(storeId, {data: event.key})
}
});
return window.dash_clientside.no_update;
}
""",
Output({"key": "store"}, "id"),
Input({"key": "store"}, "id"),
)
@AnnMarieW I confirmed this works. Thanks for the quick help!
Describe your context Please provide us your environment, so we can easily reproduce the issue.
pip list | grep dash
belowif frontend related, tell us your Browser, Version and OS
Describe the bug the new dash_clientside.set_props seems to work great except when trying to use the dict id format. when running the example code:
And a valid key is pressed (ArrowLeft, ArrowRight, Enter), the console logs this error:
However if you uncomment the lines with the id='store' and comment out the lines with the dict ids, you get no errors.
Expected behavior Might be doing something stupid on my side but if not set_props should work with both types of id formats.