Skip to content

Derived properties are calculated unnecessarily often #238

Open
@janpaul123

Description

@janpaul123

Say you have derived properties like this:

derived: {
  A: { deps: ['X'], fn:  },
  B: { deps: ['X'], fn:  },
  C: { deps: ['X'], fn:  },
  Z: { deps: ['A', 'B', 'C'], fn:  },
}

Currently, if you change X, the function for Z will trigger 3 times, like this (every letter is a function executing): A Z B Z C Z, while it's clearly sufficient to do A B C Z (or, perhaps, to not do anything until later, as suggested in #233).

There are a few workarounds for this (denormalising derived properties, using silent: true + custom events, …?) and I might post them here later, but I haven't quite figured out the pros/cons of them.

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