Skip to content

Issue when clientside callback is defined before public callback #161

Description

@Godisemo

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions