Hi folks!
When I try to use dash.ctx.triggered_id (in a callback) I’m getting this error:
Internal Server Error: /django_plotly_dash/app/Frontend/_dash-update-component
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "/usr/local/lib/python3.13/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.13/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
return view_func(request, *args, **kwargs)
File "/usr/local/lib/python3.13/site-packages/django_plotly_dash/views.py", line 75, in update
return _update(request, ident, stateless, **kwargs)
File "/usr/local/lib/python3.13/site-packages/django_plotly_dash/views.py", line 95, in _update
resp = app.dispatch_with_args(request_body, arg_map)
File "/usr/local/lib/python3.13/site-packages/django_plotly_dash/dash_wrapper.py", line 705, in dispatch_with_args
res = callback(*args, **{k: v for k, v in argMap.items() if k in parameters_to_inject})
File "/usr/local/lib/python3.13/site-packages/django_plotly_dash/_callback.py", line 82, in add_context
output_value = func(*func_args, **func_kwargs) # %% callback invoked %%
File "/home/django/src/main/frontend.py", line 159, in btn_filter_clicked
triggered_id = ctx.triggered_id
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/dash/_callback_context.py", line 20, in assert_context
if not context_value.get():
~~~~~~~~~~~~~~~~~^^
LookupError: <ContextVar name='callback_context' at 0x7fee6f0b1e90>
[20/May/2025 06:22:58] "POST /django_plotly_dash/app/Frontend/_dash-update-component HTTP/1.1" 500 15860
I’m getting a similar message when using dash.callback_context.triggered[0][‘prop_id’] as proposed here: Lookup Error When Using Context_Callback - #8 by bershika
Since this is a DjangoDash app I obviously have no app.run() call. Maybe I have to tell the DjangoDash class to somehow initialize something in addition to the normal stuff?
Any help is highly appreciated!