-
-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding LogTransform to app causes Duplicate callback output error #280
Comments
It is probably related to the recent change in callback structure when |
I have the same issue. It came up as I upgraded my project dependencies from Interestingly, I just tried deploying my app with the |
I have tried replicating the issue with a small example but I am not able to replicate it on a small example. Here is the code I used in an attempt to replicate it: import secrets
from dash_extensions.enrich import (
DashProxy,
LogTransform,
Input,
Output,
State,
DashLogger
)
from dash import dcc, html, no_update
import flask
server = flask.Flask(__name__)
app = DashProxy(
transforms=[
LogTransform(),
],
external_stylesheets=[],
server=server,
)
app.server.secret_key = secrets.token_urlsafe(16)
app.layout = html.Div([
dcc.Input(id='text_input'),
html.Button("Click me", id="input_button"),
html.Button("Click me 2", id="input_button2"),
html.H2(id="output_region")
])
@app.callback(
Output("output_region", "children", allow_duplicate=True),
State('text_input', 'value'),
Input("input_button", "n_clicks"),
prevent_initial_call=True,
log=True,
)
def callback1(
input_text: str,
button_clicks: int,
dash_logger: DashLogger
):
if not input_text:
dash_logger.warning("Please input some text value before clicking")
return no_update
return input_text
@app.callback(
Output("output_region", "children", allow_duplicate=True),
State('text_input', 'value'),
Input("input_button2", "n_clicks"),
prevent_initial_call=True,
log=True,
)
def callback2(
input_text: str,
button_clicks: int,
dash_logger: DashLogger
):
if not input_text:
dash_logger.warning("Please input some text value before clicking")
return no_update
return input_text
# Run App
if __name__ == "__main__":
app.run(debug=True) |
The app that I am running is a fairly large multi-page application. The outputs that triggered the error were not, in fact, duplicate outputs. Still, I added the The other thing that I found interesting about the callbacks that triggered the error is that they are on two of my sub-pages which are fairly deep into the application. I thought that the error would have been triggered by one of my earlier callbacks. EDIT: I "fixed" the issue by just removing the logging behaviour from the offending callbacks. For me, it was on two non-critical functions. To confirm, though, the duplicate callbacks were on the dash mantine components notifications, not any of my |
Should be fixed in the |
The issue still appears to occur, I will try to develop another MRE to indicate |
@emilhe, I might be mistaken but I think adding In my particular situation, I have two callbacks that share the same I've been trying to make the |
When adding the
LogTransform
as an app transformation:Upon opening, my app now has a
Duplicate callback outputs
error, despite not having the error without the transform.The particular output in question uses a
allow_duplicate=True
flag as needed.The text was updated successfully, but these errors were encountered: