Skip to content

Site: Explain which variables can be assigned to to trigger updates #3368

@Conduitry

Description

@Conduitry

There have been a number of issues opened about this, and a good deal of confusion. The docs indicate that if you mutate an object without there being a = involved, this doesn't trigger an update. But there's no mention that only assignments to certain variables trigger updates.

Things that do trigger updates:

  • Assignments to top-level variables in the component
  • Assignments in inline event handlers to the contextual item in an array from an each block (There are some nuances to be worked out around this, and some bugs, for which there are other issues open)

Other assignments do not trigger updates. In particular, assignments to function arguments when the function was passed one of the above two things do not trigger updates. If you have two top-level variables, and one is an array or object containing the other, and you trigger an update on the contained variable, it does not trigger an update on the containing variable.

I do not know where in the docs we should explain this, or how we should word it, but we do need to have this somewhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions