Skip to content

[EEZ Flow] Deep comparison of Structs and Watch on Struct member changes #1041

Description

@dhugoexe

Context

I'm building a Flow that needs to detect whether a Struct variable has been
edited by the user (e.g. a config sub-struct), by
comparing a saved snapshot against the current live value, and re-evaluating
whenever any member of the struct changes.

Questions

  1. Struct equality with Compare (= operator)
    Does the Compare action's = operator perform a deep, member-by-member
    comparison when both operands are of type Struct, or does it compare by
    reference ? The docs (P8. Variables) don't specify this.

  2. Assignment semantics for Structs (SetVariable)
    When doing SetVariable myVar <- otherStructVar, is the resulting value a
    deep copy, or a reference to the same underlying struct instance?

  3. Watching changes on a whole Struct
    The Watch component docs describe monitoring "the value of the
    variable" — is it possible to Watch an entire Struct variable and get
    notified if any member changes, or is Watch limited to scalar/leaf
    values, requiring one Watch per member?

Why this matters

This is a common pattern (dirty-state / "unsaved changes" detection on a
config form bound to a struct) and the docs don't currently clarify whether
struct comparison, copy, and watch semantics support it out of the box, or
whether member-by-member workarounds are required.

Thanks,

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions