Skip to content
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

Issue when clientside callback is defined before public callback #161

Open
Godisemo opened this issue Feb 3, 2025 · 0 comments · May be fixed by #162
Open

Issue when clientside callback is defined before public callback #161

Godisemo opened this issue Feb 3, 2025 · 0 comments · May be fixed by #162

Comments

@Godisemo
Copy link

Godisemo commented Feb 3, 2025

Example app below. If the clientside callback is defined before the public callback the app crashes. If the order is reversed the app works as expected.

from dash import Dash, Input, Output, clientside_callback, dcc, html

from dash_auth import public_callback

app = Dash()
app.layout = html.Div(
    [
        dcc.Location(id="url"),
        html.Div(id="clientside-callback-output"),
        html.Div(id="public-callback-output"),
    ]
)


clientside_callback(
    "function (pathname) {return `Hello ${pathname} from clientside callback!`;}",
    Output("clientside-callback-output", "children"),
    Input("url", "pathname"),
)


@public_callback(
    Output("public-callback-output", "children"),
    Input("url", "pathname"),
)
def public(pathname: str) -> str:
    return f"Hello {pathname} from public callback!"


if __name__ == "__main__":
    app.run(debug=True)
@Godisemo Godisemo linked a pull request Feb 3, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant