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

Recursion for resolving callbacks #283

Open
mhalaida opened this issue Sep 4, 2023 · 1 comment
Open

Recursion for resolving callbacks #283

mhalaida opened this issue Sep 4, 2023 · 1 comment

Comments

@mhalaida
Copy link

mhalaida commented Sep 4, 2023

I'm trying to extend my callbacks with a custom decorator for error handling & logging:

@callback(
    ...outputs
    ...inputs
)
@logging_decorator
def update_graph()
    ...

This works okay with native dash callbacks, but does not with dash-extensions callbacks, I assume dash-extensions resolves them differently. The error trace leads to line 1049 in enrich.py, I see there's a comment:

#Replace args and kwargs. # TODO: Is recursion needed?

Could this be related to how custom decorators are treated? If so, do you think this is something that could be addressed?

@joonh-min
Copy link

@mhalaida replacing 1041 with

        if (cbf:=callback.f) and hasattr(cbf, "__wrapped__"):
            full_arg_spec = inspect.getfullargspec(cbf.__wrapped__)
        else:
            full_arg_spec = inspect.getfullargspec(cbf)

fixed it for me.

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

No branches or pull requests

2 participants