Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[BUG] Inline clientside_callback scripts not found in Dash 2.9.2 #2488

Closed
RenaudLN opened this issue Mar 31, 2023 · 2 comments · Fixed by #2491
Closed

[BUG] Inline clientside_callback scripts not found in Dash 2.9.2 #2488

RenaudLN opened this issue Mar 31, 2023 · 2 comments · Fixed by #2491

Comments

@RenaudLN
Copy link
Contributor

Environment

dash                 2.9.2

Describe the bug

In Dash 2.9.2, the clientside callbacks defined inline get a random function name which seems to break. Note: the issue solves itslef when refreshing the page, however every first load triggers this issue. Tested in 2.9.1 and this does not happen, it was introduced with the random function names in 2.9.2.

Using a deterministic function name instead solves the issue:

import itertools
COUNTER = itertools.count()

def register_clientside_callback(...):
    ...

    increment = next(COUNTER)
    function_name = f"inline-script-{increment:06d}"
    ...

Expected behavior

The clientside_callbacks defined inline should work from the first load.

Screenshots

image

@T4rk1n
Copy link
Contributor

T4rk1n commented Mar 31, 2023

I put md5 on the function code in #2491 which should fix the issue, but uncovered another side effect related to hot-reload and clientside function not being actually reloaded when the code changes.

@RenaudLN
Copy link
Contributor Author

Yes hot reload on inline clientside callback hasn't been working for a while (ever?). Always need to refresh the page when updating them.

T4rk1n added a commit that referenced this issue Apr 4, 2023
Fix clientside inline function name.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants