Skip to content

[Feature Request] Enable running functionality in non-background callbacks #2559

@aGitForEveryone

Description

@aGitForEveryone

The running keyword in callbacks currently only works when background=True is set for callbacks. However, sometimes you have a normal callback, that takes a while to execute, that you don't want to turn in a background callback, but which you do want to have running functionality for.

Currently, I solve this by manually creating a callback loop, i.e. by having an entry-exit callback that disables/enables the button which then triggers a second callback that does the actual calculation. But that is a bit cumbersome to set up every time, since you have to be careful to make sure that the loop properly closes. For example, if you run the same calculation twice consecutively, the exit callback might not be triggered the second time because the calculation return data didn't change compared to the first run and therefore Dash won't update the component that triggers the loop exit condition. (The solution is to add extra data that will always update, e.g. a calculation counter)

Having this functionality enabled via the running keyword that already works for background callbacks would be amazing.

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