emilhe / dash-extensions

The dash-extensions package is a collection of utility functions, syntax extensions, and Dash components that aim to improve the Dash development experience

Home Page:https://www.dash-extensions.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blocking Callbacks Fail

ekwan opened this issue · comments

Hi! First I wanted to say how cool dash-extensions is! It's so helpful!

I'm writing a pretty complicated Dash app and I need to use a blocking transform because some of the callbacks are slow. I inserted a few of these blocking callbacks into my app with no problem, but with the latest one, I'm getting a strange error in the console (see end of this message). I get this error even with the simplest possible callback that does nothing:

    @app.callback(
        Output("dummy", "children"),
        Input("app_refresh", "n_intervals"),
        blocking=True
    )
    def some_callback(n_intervals):
        print("x")
        sleep(2)
        print("y")
        return n_intervals

Any idea what might be going wrong here? Thanks!

TypeError: Cannot read properties of undefined (reading 'data')

    at _callee2$ (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:673:58)

    at tryCatch (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:474:2404)

    at Generator._invoke (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:474:1964)

    at Generator.next (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:474:3255)

    at asyncGeneratorStep (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:482:103)

    at _next (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:484:194)

    at http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:484:364

    at new Promise (<anonymous>)

    at http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:484:97

    at handleClientside (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_6_1m1662986095.dev.js:619:28)

Ah, I might have an insight: the problem seems to have gone away when I didn't just reload the page after making code changes. I actually had to close the tab and reopen it. I wonder if the blocking transform creates some hidden page elements? Maybe it gets confused if you don't refresh everything completely?

Yes, it does. Hence, when you add new blocking callbacks, you must reload the page from scratch.

Woo! You might want to make a note in the documentation about that, as this error was driving me crazy! Thanks again for making such a useful addition to Dash!