Skip to content

graphile/subscriptions-lds does not trigger on DELETE if subscription contains only edges #818

Open
@Temetz

Description

@Temetz

Summary

If the subscription contains only edges, the subscription doesnt provide live updates for delete.
For create and update this works as expexted.

Steps to reproduce

  • If we have the following database table:
  CREATE TABLE comments (id INTEGER PRIMARY KEY AUTOINCREMENT, content TEXT);
  • The follwing subscription will ONLY get updates on row insert and update:
subscription Comment {
  allComemnts {
    edges {
      id
      content
    }
  }
}
  • However adding the nodes section (with any column in the table) will allow row delete notifications:
subscription Comment {
  allComments {
    nodes {
      id
    }
    edges {
     id
     content
    }
  }
}

Expected results

When row is deleted subscription data should update even if query contains only edges.

Actual results

Row deletion does not update the data, unless nodes section is specified.

Additional context

  • Postgres: 14
  • postgraphile: 4.12.11
  • @graphile/subscriptions-lds: 4.12.3

Possible Solution

As a workaround you can define any column in the nodes section, like so. This will allow you to get updates on row deletes.

subscription Comment {
  allComments {
    nodes {
      id
    }
    edges {
     id
     content
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions