PreventUpdate for ClientSide callbacks

I’m trying to write a ClientSide callback that can throttle how often a ServerSide callback gets called by some custom logic. If this was a ServerSide callback, I would raise dash.exceptions.PreventUpdate, but that isn’t available in the ClientSide callback. I can throw an error, but this clutters the console. Is there a recommended way to do this?

Edit: I will note that debounce on a ClientSide callbacks doesn’t work, because while the debounce will reduce how often data gets sent back to the server, it still effectively returns undefined, which is considered an update and triggers the next callback.

See 📣 Dash 0.41.0 released regarding no_update in the Partial Multi-output section

no_update is on the python side still. I’m wondering what I can use on the javascript side to be in effect no_update. For now, I continue to just throw Exceptions.

Raising an exception / throwing an error is the way to go right now. no_update nor callback_context has been provided for the ClientsideCallbacks yet.

Hi chriddyp,

Thanks for confirming my suspicions. I’m still struggling to properly throttle the calls back to the server. Mostly because we can’t make ClientSide callbacks that don’t return anything, IE they mutate the DOM. There might be a way to do this with a Promise, but those don’t work as well for ClietnSide callbacks right now. I imagine directly mutating the DOM is a no-no with React, but I’m not seeing much of an alternative. My thoughts at a work around are this:
1.) Make a dummy Store
2.) Create a ClientSide callback that modifies a useless parameter for the Store such as it’s class, and have that return always be the same thing: ""
This is an attempt to make a ClientSide callback that basically has no Output
3.) Run a debounced function that mutates the data parameter of the dummy Store
4.) Have a ServerSide callback using that dummy Store’s data as an Input.

It’s also very possible I’m overthinking this.