Hello,
I have the following callbacks:
@app.callback(
Output('mail-modal', "is_open", allow_duplicate=True),
Output(modal_id, "is_open"),
Input('info-mailto-person', 'n_clicks'),
prevent_initial_call=True
)
def toggle_mail_modal(mailto_clicks, is_open):
if not mailto_clicks:
raise PreventUpdate
return True, False
@app.callback(
Output('mail-modal', "is_open"),
Output('email-is-sent-alert', 'is_open'),
Output('modal-form-email-feedback', 'children'),
Output('modal-form-subject-feedback', 'children'),
Output('modal-form-text-feedback', 'children'),
Output('modal-form-general-feedback', 'children'),
Input('modal-send-email-button', 'n_clicks'),
State('modal-form-email', 'value'),
State('modal-form-subject', 'value'),
State('modal-form-text', 'value'),
prevent_initial_call=True
)
def send_email(clicks, email, subject, text):
# some code
even with specified allow_duplicate=True, i get an error:
"In the callback for output(s):
mail-modal.is_open@5d812f45153073fc6b2e0d2b62389aa2
Output 0 (mail-modal.is_open@5d812f45153073fc6b2e0d2b62389aa2) is already in use.
To resolve this, set `allow_duplicate=True` on
duplicate outputs, or combine the outputs into
one callback function, distinguishing the trigger
by using `dash.callback_context` if necessary."
I could try to combine the callbacks into one, but i don’t like this idea, so maybe someone know at least why allow_duplicate doesn’t work?