Weird pattern-matching / callback behavior

Hi,

I have some weird pattern-matching / callback issue with the following callback signature:

@callback(
        [
            Output('simulation_output', 'children'),
            Output('assetCompare', 'data')
        ],
        [
            Input('simulate_button', 'n_clicks'),
            Input('compare_button', 'n_clicks'),
            Input({'role': 'selectCompareCard',  'index': ALL}, 'checked'),
            Input({'role': 'deleteCompareCard',  'index': ALL}, 'n_clicks'),
            Input({'role': 'btn_simulate_all', 'index': ALL}, 'n_clicks'),
        ],
        [ 
            State('asset', 'value'),
            State('simulationTypeRadio', 'value'),
            State('startDate', 'value'),
            State('maxInvestment', 'value'),
            State('frequency', 'value'),   
            State('baseAmount', 'value'),
            State('minRequiredDrawDown', 'value'),
            State('crashSelectionDropDown', 'value'),
            State('crashSelectionDropDown', 'data'),
            State('assetCompare', 'data'),
        ],
        prevent_initial_call=False,
        background=False)

the compare button will add the item to the compare list and it will generate dynamically a list with on top one simulate all button and then as many comparision card as needed which each their edit, delete, select, … actions…

Everything works as expected, except for the ‘btn_simulate_all’, only triggers the callback after I have first triggered any of the other pattern matching (selectCompareCard or deleteCompareCard) events.

Any ideas on what might cause this behavior? Thanks

Hello @jcuypers,

It’s really hard to say without seeing more of what is going on, only the paeans of the callback it is really hard to understand.

2 Likes

Hi @jinnyzor, while preparing/tidying up some more code to clarify my post, I noticed I had missed to replace one context output with my generic output function that I used elsewhere. It is working now. sorry for this.

1 Like