Data Router ยท console.warn
the unnest "{as}" produced the child key "{k...
Printed by Data Router, prefixed [lattice], since 1.84.0.
Warnings reference › router:unnest-duplicate-key
- Identifier
router:unnest-duplicate-key- Raised by
- Data Router
- Since
- 1.84.0
What happened
Two elements of one parent's nested array resolved to the same child key - a duplicated id under a key: 'id' spec, most often. The router is last-writer-wins in the array's source order: the later child's row stands, the earlier is overwritten, rather than collecting or throwing. Warned once per router, not per parent.
The fix
Make the child key (or the array's own ids) unique within each parent, or switch to the default index key.
The smallest fix
addSource('company', { unnest: [{ path: 'addresses', as: 'address', key: 'id', parentKey: 'companyId' }] })
Reference
Covered in full at the API reference.