Skip to content

fix: add docs snippets; fix open api issues - #1913

Merged
szuperaz merged 11 commits into
release-v10from
docs-snippet-tests-v10
Oct 16, 2026
Merged

szuperaz merged 11 commits into
release-v10from
docs-snippet-tests-v10

Conversation

@szuperaz

@szuperaz szuperaz commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

https://linear.app/stream/issue/REACT-1069/migrate-client-side-chat-qa-tests-to-v10-of-stream-chat-js

Migrates the docs-snippets test project from v9 -> v10. It contains all docs and platfrom stream-chat-js docs snippets we have. Relevant docs branch: https://github.com/GetStream/getstream.io/pull/683 (will be kept in sync with getstream.io/main until we're ready to release stream-chat-js).

Most changes are to docs-snippet project, and src/gen, however, some client issues were found by the tests and those are fixed as well, so PR title is fix.

Fixed client issues

Most changes are type fixes, 1-2 behavioral; here are the most important ones:

  • queryThreadsAndHydrate / getThreadAndHydrate now return the already-registered Thread through the new ThreadManager.resolveQueried. Before, they built a second instance that activate() and incoming events didn't reach. A registered thread that is out of date and not open gets refreshed from the query result.
  • channel.sendEvent method expected the response Event type, instead of the request. So it expected fields like created_at, custom. Fixed it, this method now expects the event request type
  • client.devToken() is back (I think this was mistakenly removed with other server-side stuff)

TODOs

Apart from the client changes in this PR, we have 3 small, pending todos to generator/open api spec. All tracked in the docs-todo file. The run also caught a bunch of smaller API behavior issues; since these issues are present on api v1 and v2 as well, they're not blocking us. I'll verify the findings and pass them to the backend team once I have the time.

Comment thread src/channel.ts
custom: {},
// The API reads the AI indicator fields from `custom` and puts them on the event it
// delivers. They aren't app custom data, hence the assertion.
custom: {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one threw me off at first, but I verified that, for ai_indicator.update events, the message_id and ai_state fields need to be wrapped in custom, but then when the backend broadcasts the event, it will read these fields from custom and add them to event.message_id and event.ai_state.

@szuperaz
szuperaz marked this pull request as ready for review October 15, 2026 20:31
@szuperaz
szuperaz merged commit 53505e7 into release-v10 Oct 16, 2026
6 checks passed
@szuperaz
szuperaz deleted the docs-snippet-tests-v10 branch October 16, 2026 15:50
github-actions Bot pushed a commit that referenced this pull request Oct 20, 2026
## [10.0.0-rc.23](v10.0.0-rc.22...v10.0.0-rc.23) (2026-10-20)

### Bug Fixes

* add docs snippets; fix open api issues ([#1913](#1913)) ([53505e7](53505e7))
* address code issues found while reviewing v10 source comments ([#1922](#1922)) ([2fc319e](2fc319e))
* v10 in depth review hotfixes ([#1920](#1920)) ([98a298d](98a298d))
@stream-ci-bot

Copy link
Copy Markdown

🎉 This PR is included in version 10.0.0-rc.23 🎉

The release is available on:

Your semantic-release bot 📦🚀

isekovanic added a commit that referenced this pull request Oct 21, 2026
## CLA

- [ ] I have signed the [Stream
CLA](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform)
(required).
- [x] Code changes are tested

## Description of the changes, What, Why and How?

Since #1913, `getThreadAndHydrate` returns the thread registered in
`client.threads` instead of the copy it builds, and skips hydrating it
when the thread is open. `thread.reload()` went through
`getThreadAndHydrate`, so an open thread got itself back and
`hydrateState(this)` returned early. Connection recovery reloads every
open thread, and none of them caught up: replies sent while the user was
offline never appeared, even after closing and reopening the thread.

### Reload

`thread.reload()` calls `client.getThread` and hydrates itself with the
answer, merged into the loaded window as before. It no longer depends on
the thread being registered.

### Hydrating from a response

`thread.hydrateState` takes the server response (`ThreadStateResponse`)
instead of another `Thread`, like `client.hydrateChannels` and
`client.reminders.hydrateState` take data. The mapping from response to
state is shared with the constructor (`formatThreadState`).
`skipReplies` updates the state and leaves the replies and
`isStateStale` alone.

### Queried threads

`ThreadManager.resolveQueried` takes the response instead of a copy. It
returns a new `Thread` when none is registered, otherwise the registered
one with its state updated:

- open: replies left to its own `reload()`
- stale and not open (every closed thread after a reconnect): replies
replaced by the answer
- current and not open: replies left alone, events kept them current

Queries no longer build a copy for threads that are already registered.
Each copy used to keep its replies held in the shared message store, so
every thread list reload pinned the listed threads' newest replies for
good. `ThreadPaginator.toStoredInstance` is removed, since
`queryThreadsAndHydrate` already returns the stored instance.

### Behaviour changes

- A registered thread that is open, or not stale, now gets its state
(title, read state, reply count, participants, parent message) from the
query. Before, it was returned untouched.
- Thread responses no longer refresh the channel's `custom` data and
members for threads that are already registered. That only happened as a
side effect of building the discarded copy.
- A second `ThreadManager`, or a `ThreadPaginator` with a private store,
no longer dedupes queried threads against its own store.

### Tests

The reload and thread list tests stubbed `getThreadAndHydrate` /
`queryThreadsAndHydrate` with ready-made `Thread` copies, which is why
none of them caught the regression. They now stub the raw `getThread` /
`queryThreads`, so the registry lookup runs. New tests cover reloading a
registered open thread and the three `resolveQueried` cases.

## Changelog

- Fixed `thread.reload()` not applying the fetched replies to an open
thread, so open threads catch up after reconnecting
- Fixed thread queries leaving the replies of already registered threads
held in the message store
- `thread.hydrateState` now takes a thread response
(`ThreadStateResponse`) instead of another `Thread` (breaking)
- Thread queries now update the state of registered threads in place,
including open ones
github-actions Bot pushed a commit that referenced this pull request Oct 22, 2026
## [10.0.0-rc.24](v10.0.0-rc.23...v10.0.0-rc.24) (2026-10-22)

### ⚠ BREAKING CHANGES

* remove messageSetToAddToIfDoesNotExist and let the message paginator place every page (#1926)
* open api hot fixes (#1927)

### Bug Fixes

* apply thread reloads and queries to the registered thread ([#1929](#1929)) ([acb33c4](acb33c4)), closes [#1913](#1913)
* open api hot fixes ([#1927](#1927)) ([4fb4b52](4fb4b52))

### Features

* remove messageSetToAddToIfDoesNotExist and let the message paginator place every page ([#1926](#1926)) ([2b7960d](2b7960d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants