Skip to content

Ability to prevent initial callback from firing #1225

@alexcjohnson

Description

@alexcjohnson

@chriddyp started prototyping this in #1123 and I'm preparing a new PR that will supersede #1123 with a more complete implementation and tests. But a question about how this should work regarding later callbacks:

Currently if all of the inputs to callback C are themselves outputs to other callbacks A and B, we effectively do not treat C as an "initial callback" - that is, it won't trigger without one of its inputs changing, so if A and B both raise PreventUpdate on page load (or layout chunk load), C will not be called.

The question is how this should apply to prevent_initial_call - if A and B both have prevent_initial_call=True, is that equivalent to PreventUpdate so C should not fire? Or is it as though A and B are simply not considered initially and the initialization chain should start at C?

My initial reaction is that this case is not the same as PreventUpdate and C should fire. My reasoning:

  • Presumably in this situation you've set the initial values for A and B as part of the layout - so it's not so much that you're preventing an update, it's just that for performance reasons you've already made the update happen.
  • If you do want C to fire and we automatically prevent it, you'd have to do something super hacky like add an extra input. On the other hand, if we allow it to fire and you don't want that, all you have to do is set prevent_initial_call=True on C as well.

Anyone care to argue the other side? @Marc-Andre-Rivet @chriddyp @christianwengert do you agree?

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