Lattice Grid Buy a licence

Data Router ยท console.warn

relate({ mutual: true }) with a function relation cannot be inverted; the same predicate is applied in both directions. Use a { from, to } key map for a mutual edge.

Printed by Data Router, prefixed [lattice], since 1.32.0.

Warnings referencedata-router:mutual-fn

Identifier
data-router:mutual-fn
Raised by
Data Router
Since
1.32.0

What happened

A mutual relation is built by inverting the relation for the reverse direction. A { from, to } key map inverts exactly; a function cannot be inverted safely, so the same predicate is reused in both directions - which is right only if the predicate happens to be symmetric.

The fix

Express a mutual relation as a key map. Keep the function and declare the two directions separately if the relation is genuinely asymmetric.

The smallest fix

router.relate(a, b, { from: 'id', to: 'parentId' }, { mutual: true });

Reference

Covered in full at the API reference.