Querying a channel clears `quoted_message_id` on a reply that was itself quoted
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- backend-api-design
Direzione di ricerca
Start by tracing the TypeScript client entry points for channel.query and queryChannels, then compare the query response with getMessage as described in the reproduction. The report points to a likely server-side mutation, so use the reproduction conditions to determine whether this repository exposes a relevant request or response path. Done means a read leaves R's quoted_message_id intact.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
A reply loses its quote after a channel query. When R quotes an older message M and R2 then quotes R, a later channel.query({ state: true }) returns R without quoted_message_id, and the stored message follows within about a second: getMessage(R.id) also returns R without it from then on, with no change to updated_at and no message.updated event. Clients then render R without its quote.
It happens only when both are true:
- M is not among the 100 most recent messages of the channel at query time: kept when M is the 100th most recent (97 messages between M and R), cleared when it is the 101st or older (98 or more);
- the query response contains both R and R2. With only R, only R2 or neither in the response, R keeps its quote.
In the same response that returns R without quoted_message_id, R2's quoted_message (which is R) still has quoted_message_id: M.id.
To reproduce
Two users in a new messaging channel:
- User A sends M.
- Send 98 or more messages.
- User A sends R with
quoted_message_id: M.id. - User B sends R2 with
quoted_message_id: R.id. - Server-side
getMessage(R.id):quoted_message_idis M.id. - User A calls
channel.query({ state: true }). R in the response already comes back withoutquoted_message_id. - About a second later, server-side
getMessage(R.id): R comes back withoutquoted_message_id.
import { StreamChat } from "stream-chat";
const { STREAM_API_KEY: key, STREAM_API_SECRET: secret } = process.env;
const server = new StreamChat(key, secret);
const channelId = `quote-repro-${Date.now()}`;
await server.upsertUsers([{ id: "repro-a" }, { id: "repro-b" }]);
const channel = server.channel("messaging", channelId, { members: ["repro-a", "repro-b"], created_by_id: "repro-a" });
await channel.create();
const send = (user_id, text, extra = {}) => channel.sendMessage({ text, user_id, ...extra });
const { message: m } = await send("repro-a", "M");
for (let i = 1; i <= 98; i += 1) await send(i % 2 ? "repro-b" : "repro-a", `Filler ${i}`);
const { message: r } = await send("repro-a", "R", { quoted_message_id: m.id });
await send("repro-b", "R2", { quoted_message_id: r.id });
console.log("before:", (await server.getMessage(r.id)).message.quoted_message_id); // M's id
const userA = new StreamChat(key, { allowServerSideConnect: true });
await userA.connectUser({ id: "repro-a" }, server.createToken("repro-a"));
const { messages } = await userA.channel("messaging", channelId).query({ state: true });
console.log("R in the query response:", messages.find((message) => message.id === r.id).quoted_message_id); // undefined
await userA.disconnectUser();
// The stored message is updated asynchronously, right after the query.
await new Promise((resolve) => setTimeout(resolve, 2000));
console.log("after:", (await server.getMessage(r.id)).message.quoted_message_id); // undefined
Expected behavior
R keeps quoted_message_id: M.id after any read.
What we checked
- 15 out of 15 runs under the conditions above cleared R; 14 out of 14 runs outside them kept it (97 messages between M and R, no R2, or a response with only R or only R2). Who sends R and R2 (server or user clients) doesn't matter.
- The position counts at query time, not when R2 is sent: sending more messages after R2 also triggers it.
query({ state: true, watch: true })clears it too, and we saw the same withqueryChannels(state, watch and presence) in our app. The request is a plainPOST /channels/messaging/<id>/querywith{"data":{},"state":true}, so this looks like a server-side issue rather than an SDK one. Happy to move it to support if that's the better place.
Package version
- stream-chat: 9.43.2
- Node: 24.22.1
- Lingua principale
- TypeScript
- Stelle
- 211
- Fork
- 84
- Merge medio
- 1g 2h
- PR unite (30g)
- 89
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di GetStream/stream-chat-js
-
Error helpers in errors.ts (isAPIError, isErrorRetryable, APIErrorCodes) are not exported from the package entry pointForse già presa @Tyagiquamar l’ha presa 73 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
GetStream/stream-chat-js#1848 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
GetStream/stream-chat-js#1719 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
GetStream/stream-chat-js#1777 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
GetStream/stream-chat-js#1680 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
GetStream/stream-chat-js#1668 · 5 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di GetStream/stream-chat-js
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
siyuan-note/siyuan#21692 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
GetStream/stream-chat-react#3467 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
resend/resend-node#1206 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cloudflare/cloudflare-typescript#2821 ·