graphile / graphile/graphile-engine

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

Open
#818 0 comments 0 reactions 0 assignees View on GitHub
🐛 bug help wanted
Dominant language
JavaScript
Stars
764
Forks
128
PR merge metrics
No merged PRs in 30d

Description

### 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:
```sql
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
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.