graphile / graphile/crystal

Live queries do not always emit new data when a condition is specified

Open
#1,243 3 comments 0 reactions 0 assignees View on GitHub
🌿 live-queries
Dominant language
TypeScript
Stars
12.9k
Forks
625
Avg merge
5h 23m
Merged PRs (30d)
24

Description

I'm submitting a ...

* [X] bug report

PostGraphile version: 4.5.5

Minimal SQL file that can be loaded into a clean database:

```sql

CREATE TABLE public.users
(
user_id integer NOT NULL DEFAULT nextval('users_id_seq'::regclass),
created_at tsms NOT NULL DEFAULT (date_part('epoch'::text, now()) * (1000)::double precision),
updated_at tsms NOT NULL DEFAULT (date_part('epoch'::text, now()) * (1000)::double precision),
display_name text COLLATE pg_catalog."default" NOT NULL,
email text COLLATE pg_catalog."default" NOT NULL,
on_the_clock boolean NOT NULL DEFAULT false,
clock_location text COLLATE pg_catalog."default",
clock_job text COLLATE pg_catalog."default",
clock_start tsms,
CONSTRAINT users_pkey PRIMARY KEY (user_id)
)

CREATE INDEX "displayName_idx"
ON public.users USING btree
(display_name COLLATE pg_catalog."default" ASC NULLS LAST)
TABLESPACE pg_default;

CREATE INDEX email_idx
ON public.users USING btree
(email COLLATE pg_catalog."default" ASC NULLS LAST)
TABLESPACE pg_default;

CREATE INDEX on_the_clock_idx
ON public.users USING btree
(on_the_clock ASC NULLS LAST)
TABLESPACE pg_default;
```

Steps to reproduce:

Start a live query as follows:

```
subscription WhosWorking {
users(orderBy: [DISPLAY_NAME_ASC], condition: {onTheClock: true}) {
edges {
node {
id
userId
displayName
clockJob
clockStart
}
}
}
}
```

Current behavior:

* when a users transitions, onTheClock: false -> onTheClock: true, an update message via websocket with a new list is sent
* when a user transitions, onTheClock: true -> onTheClock: false, there is **no** update message via websocket

Expected behavior:

When the transition onTheClock: true -> onTheClock: false happens, a new list is sent via a websocket update message.

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.