Announcing Dash Bio 1.0.0 🎉 : a one-stop-shop for bioinformatics and drug development visualizations.

Catch initial Callback with ctx.triggered

Hello.

Since i have problems with debugging initial callbacks, i can not examine these, the question: what is the way to catch the inital callback? I want to execute some code only in the initial callback (so in an if statement determined by ctx.triggered). How could ctx.triggered[0][‘prop_id’].split(’.’)[0] help with my problem?

Hi,

To my knowledge this approach depends on the callback, as ctx.triggered[0][‘prop_id’] is “.” on the initial call just for callbacks “on top of the dependency tree”, meaning callbacks where the Inputs are not modified by other callbacks.

A callback that depends just other one(s) on top of the tree but with prevent_initial_call = True will behave similarly, as it isn’t triggered by any changes in dependent components.

Ah okay thank you for your answer, so if my callback is not influenced by another callback, i could do the following:
if ctx.triggered[0][‘prop_id’] == “.” : execute code...