I made a callback chain where:
- First callback fills layout component values in
- Second callback handles these values
The problem is when the first calls the second i can’t detect it, handling a call has to happen on a user input only.
I would like to find something like:
@callback(Output('text component', 'chidlren',
if not ctx.triggered_in_chain:
I would have different inputs, one for user input and the other for the callback.
Using the ctx you can know which triggered it, and which value gets used.
Well, i simply make a RangeSlider with date values in a user scope.
So i have to:
- Create a blank RangeSlider
- Log in
- Read user data
- Fill the RangeSlider values in with this data
- Handle the RangeSLider values update
Only one input has to be formed in the scenario.
Step 4 trigger steps 5 and it looks like as a user input, but it isn’t. The behavior is unfortunate as i create events on every user action.
Is there any flag on subject without workaround?
You could have a div that gets populated the first time the slider gets set, then use that state of true to determine that the user set the changes instead of the callback.
Ok, i think i get the idea, but could you give any example or a link to it?
@callback(Output('text component', 'chidlren', Output('testing','children'),
Input('shared-component', 'value'), State('testing','children')))
def second_cbk(v, s):
return dash.no_update, True
Or something along these lines, where
testing is a div with no children in your layout.
I actually ended up with a server side flags storage to avoid problems with the race condition and etc as the way you suggested is sending states.
As long as you get something that works.