Skip to content

Chained Derived values not fully updating with Effects when nested #54

@CNSeniorious000

Description

@CNSeniorious000

Chained Derived nodes do not update all the way through in an effect context when the base state changes. Only the first few update, and others lag behind unless accessed explicitly as a group (e.g. via another Derived).

class C:
    s = State(0)

    @DerivedProperty
    def d1(self): return self.s

    @DerivedProperty
    def d2(self): return self.d1

    @DerivedProperty
    def d3(self): return self.d2

    @DerivedProperty
    def d4(self): return self.d3

o = C()

with effect(lambda: print(o.s, o.d1, o.d2, o.d3, o.d4)):
    # 0 0 0 0 0
    o.s = 1
    # Expected: 1 1 1 1 1
    # Actual: The chain may print 1 0 0 0 0, or partial update like 1 1 1 0 0, etc.

@Derived
def d5():
    return o.s, o.d1, o.d2, o.d3, o.d4

with effect(lambda: print(*d5())):
    # Expected: 1 1 1 1 1
    o.s = 2
    # Also fails: not all values refreshed to 2 in one go.

Expected:

  • All chained Derived dependents should reflect the new state in one recomputation pass under an effect (or with top-level Derived).
  • Nested deriveds should not require explicit access/coercion to update during effects.

Actual:

  • The update only propagates partway through the chain, depending on update order/access, until all deriveds are pulled via a parent Derived or manually.

Metadata

Metadata

Assignees

No one assigned

    Labels

    coreRelated to the `hmr` packagereactivityRelated to the `reactivity` module and reactive programming

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions