We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Similar to this but for regular callbacks and more generalizable: #2588
Right now it's possible to use the cancel argument in a regular callback but it will have no effect.
cancel
Use case: in a complex multi-page app, being able to cancel running and callbacks when a user switchs from one page to another free up resources.
Sample app (cancel button doesn't do anything):
# dash==3.0.2 from dash import Dash, Input, Output, html, callback app = Dash(__name__) app.layout = html.Div( [ html.Div([html.P(id="paragraph_id", children=["Button not clicked"])]), html.Button(id="button_id", children="Run Job!"), html.Button(id="cancel_button_id", children="Cancel Running Job!"), ] ) @callback( output=Output("paragraph_id", "children"), inputs=Input("button_id", "n_clicks"), running=[ (Output("button_id", "disabled"), True, False), (Output("cancel_button_id", "disabled"), False, True), ], cancel=[Input("cancel_button_id", "n_clicks")], ) def update_clicks(n_clicks): return [f"Clicked {n_clicks} times"] if __name__ == "__main__": app.run(debug=True)
The text was updated successfully, but these errors were encountered:
cancel is only possible with background callbacks, should add an exception when cancel is defined but background=False.
Sorry, something went wrong.
@T4rk1n should we close this as not possible?
Yes the docstring are updated by this PR #3263 to reflect this.
No branches or pull requests
Similar to this but for regular callbacks and more generalizable: #2588
Right now it's possible to use the
cancel
argument in a regular callback but it will have no effect.Use case: in a complex multi-page app, being able to cancel running and callbacks when a user switchs from one page to another free up resources.
Sample app (cancel button doesn't do anything):
The text was updated successfully, but these errors were encountered: