Skip to content

0.6.0 Includes with multiple toArray fails #1425

@boyswan

Description

@boyswan
  • [ x ] I've validated the bug against the latest version of DB packages

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

export const myCollection = createLiveQueryCollection({
  getKey: x => x.id,
  query: q => q
    .from({ tf: parentCollection })
    .select(({ tf }) => ({
      id: tf.id,
      nodesA: toArray(q
        .from({ n: flowCollection })
        .where(({ n }) => eq(n.id, tf.flow_id))),
      nodesB: toArray(q
        .from({ n: flowCollection })
        .where(({ n }) => eq(n.id, tf.flow_id))),
     ...

Both nodesA and nodesB should be an array of 1 item.

In the example above I get:

{
    "id": "e31ac544-9b50-4324-baa5-b4c836ed4cee",
    "nodesA": [ { ... } ],
    "nodesB": [],  <------ missing data
    "$synced": true,
    "$origin": "remote",
    "$key": "e31ac544-9b50-4324-baa5-b4c836ed4cee",
    "$collectionId": "live-query-7"
}

If I remove nodesA from the query, I get:

{
    "id": "e31ac544-9b50-4324-baa5-b4c836ed4cee",
    "nodesB": [ { ... } ],
    "$synced": true,
    "$origin": "remote",
    "$key": "e31ac544-9b50-4324-baa5-b4c836ed4cee",
    "$collectionId": "live-query-7"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions