My app recently becomes very slow, esspecially when loading a site or change the url through the navigation bar. I wonder what actually is computed between the click of the navigation bar and the incoming input of the url Location Callback. Because there is a long time until the callback is received.
Edit: I could figure out which callback exactly makes the app slow. Know i wonder if its a bad idea to implement the PatternMatchCallback as complex as it is here:
from dash import Input, Output, State, MATCH
import dash
from dash.exceptions import PreventUpdate
def addGeneralCallbacks():
@app.callback(
Output({'a': MATCH, 'b': MATCH, 'c': MATCH, 'd': MATCH, 'e': MATCH, 'f': MATCH, 'g': MATCH,'h': 'dropdown'}, "value"),
Output({'a': MATCH, 'b': MATCH, 'c': MATCH, 'd': MATCH, 'e': MATCH, 'f': MATCH, 'g': MATCH,'h': 'dropdown'}, "options"),
Input({'a': MATCH, 'b': MATCH, 'c': MATCH, 'd': MATCH, 'e': MATCH, 'f': MATCH, 'g': MATCH,'h': 'submit'}, "n_clicks"),
State({'a': MATCH, 'b': MATCH, 'c': MATCH, 'd': MATCH, 'e': MATCH, 'f': MATCH, 'g': MATCH,'h': 'addNew'}, 'value'),
State({'a': MATCH, 'b': MATCH, 'c': MATCH, 'd': MATCH, 'e': MATCH, 'f': MATCH, 'g': MATCH,'h': 'dropdown'}, 'value')
)
def addValueToMulti(n, valueToAdd, value):
ctx = dash.callback_context
if not ctx.triggered:
raise PreventUpdate
elif valueToAdd and (valueToAdd not in value):
value.append(valueToAdd)
options = [{'label': v, 'value': v} for v in value]
return value, options
else:
raise PreventUpdate
Any information about this @chriddyp @AnnMarieW ? Is it becoming slower if i use more keywords in the patternmatch ids?
Best regards!