Describe the bug
When two sibling includes in .select() use the same alias letter, nested child collections silently produce empty results. No error or warning is produced — data is silently lost.
For example, if an issues include uses { i: issues } and a sibling tags include uses { i: tags }, any nested grandchild inside issues (e.g., comments) returns empty. Changing the tags alias to { t: tags } fixes it.
Reproducible with this test in PR #1455.
Steps to Reproduce
const collection = createLiveQueryCollection((q) =>
q.from({ p: projects }).select(({ p }) => ({
id: p.id,
issues: q
.from({ i: issues }) // alias "i"
.where(({ i }) => eq(i.projectId, p.id))
.select(({ i }) => ({
id: i.id,
comments: q // nested grandchild
.from({ c: comments })
.where(({ c }) => eq(c.issueId, i.id))
.select(({ c }) => ({ id: c.id, body: c.body })),
})),
tags: q
.from({ i: tags }) // same alias "i" — breaks comments above
.where(({ i }) => eq(i.projectId, p.id))
.select(({ i }) => ({ id: i.id, label: i.label })),
})),
)
await collection.preload()
const alpha = collection.get(1)
const issue10 = alpha.issues.get(10)
issue10.comments // empty — should contain comments for issue 10
Observed Behavior
tags is populated correctly
issues contains rows, but they come from the wrong collection (tags data routed to the issues pipeline)
- Nested
comments inside issues is always empty
- No error or warning is thrown
Expected Behavior
Aliases in sibling includes should be independent scopes. Using the same alias letter in different sibling subqueries should just work — each gets its own data pipeline.
Describe the bug
When two sibling includes in
.select()use the same alias letter, nested child collections silently produce empty results. No error or warning is produced — data is silently lost.For example, if an
issuesinclude uses{ i: issues }and a siblingtagsinclude uses{ i: tags }, any nested grandchild insideissues(e.g.,comments) returns empty. Changing the tags alias to{ t: tags }fixes it.Reproducible with this test in PR #1455.
Steps to Reproduce
Observed Behavior
tagsis populated correctlyissuescontains rows, but they come from the wrong collection (tags data routed to the issues pipeline)commentsinside issues is always emptyExpected Behavior
Aliases in sibling includes should be independent scopes. Using the same alias letter in different sibling subqueries should just work — each gets its own data pipeline.