Skip to content

Commit ccccce5

Browse files
szuperazclaude
andauthored
fix: adapt to removed stream-chat-js hand-written types (#3274)
Not yet ready to be merged Relevant stream-chat-js PR: GetStream/stream-chat-js#1836 ### 🎯 Goal _Describe why we are making this change_ ### πŸ›  Implementation details _Provide a description of the implementation_ ### 🎨 UI Changes _Add relevant screenshots_ --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent f68cad3 commit ccccce5

30 files changed

Lines changed: 104 additions & 92 deletions

File tree

β€ŽAI.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const App = () => {
5959
For a full-featured chat interface:
6060

6161
```tsx
62-
import type { ChannelFilters, ChannelOptions, ChannelSort, User } from 'stream-chat';
62+
import type { ChannelFilters, ChannelOptions, SortParamRequest, User } from 'stream-chat';
6363
import {
6464
Chat,
6565
Channel,
@@ -86,7 +86,7 @@ const user: User = {
8686
image: `https://getstream.io/random_png/?name=${userName}`,
8787
};
8888

89-
const sort: ChannelSort = { last_message_at: -1 };
89+
const sort: SortParamRequest[] = [{ direction: -1, field: 'last_message_at' }];
9090
const filters: ChannelFilters = {
9191
type: 'messaging',
9292
members: { $in: [userId] },

β€Žai-docs/ai-migration.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Authoritative locations, in order of preference:
1111
1. `node_modules/stream-chat-react/dist/types/index.d.ts` β€” public type surface. Fastest way to confirm a symbol exists, check a prop signature, or see an override-key name. (The SDK emits `.d.ts` only; there is no `.d.cts`.)
1212
2. `node_modules/stream-chat-react/package.json` β€” `exports` map and peer dependencies.
1313
3. `node_modules/stream-chat-react/dist/es/` and `dist/cjs/` β€” transpiled JS when runtime behavior matters more than types.
14-
4. `node_modules/stream-chat/dist/types/index.d.ts` β€” core client types (channel capabilities, event names, `ReactionSort`, etc.).
14+
4. `node_modules/stream-chat/dist/types/index.d.ts` β€” core client types (channel capabilities, event names, `SortParamRequest`, etc.).
1515
5. `node_modules/stream-chat-react/dist/css/index.css` β€” default class names and CSS variables when auditing selectors.
1616

1717
Required workflow:
@@ -166,7 +166,7 @@ For richer rendering, override `QuotedMessage` or `QuotedMessagePreview` in `Wit
166166
- `QuotedMessagePreviewHeader` β†’ `QuotedMessagePreviewUI`
167167
- `CardAudio` β†’ inline the audio card UI in your own component
168168
- `attachmentTypeIconMap` β†’ inline your own map or use `SummarizedMessagePreview`
169-
- `ReactionDetailsComparator`, `sortReactionDetails` prop β†’ `reactionDetailsSort` with `ReactionSort`
169+
- `ReactionDetailsComparator`, `sortReactionDetails` prop β†’ `reactionDetailsSort` with `SortParamRequest[]`
170170
- `SimpleReactionsList` β†’ `MessageReactions` or a custom compact list
171171
- Standalone icons (`ActionsIcon`, `ReactionIcon`, `ThreadIcon`, `MessageErrorIcon`, `CloseIcon`, `SendIcon`, `MicIcon`, `MessageSentIcon`, `MessageDeliveredIcon`, `RetryIcon`, `DownloadIcon`, `LinkIcon`) β†’ public `Icons` set (e.g. `IconXmark`, `IconCheckmark1Small`, `IconDoubleCheckmark1Small`) or higher-level components (`SendButton`, `MessageStatus`, `MessageActions`)
172172
- `useChannelDeletedListener`, `useNotificationMessageNewListener`, `useMobileNavigation`, siblings β†’ no shim; remove the calls (`ChannelList` handles these events internally)

β€Žai-docs/breaking-changes.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,14 +1995,14 @@ Only confirmed items should move from this file into the migration guide.
19951995
- `f06846da:src/components/Reactions/hooks/useProcessReactions.tsx:12` through `:14` still accepted `reaction_counts` and `reactionOptions`
19961996
- `f06846da:src/components/Reactions/types.ts:14` still exported `ReactionDetailsComparator`
19971997
- New API:
1998-
- `src/components/Message/types.ts:83` and `src/context/MessageContext.tsx:107` now expose `reactionDetailsSort?: ReactionSort`
1998+
- `src/components/Message/types.ts:83` and `src/context/MessageContext.tsx:107` now expose `reactionDetailsSort?: SortParamRequest[]`
19991999
- `src/components/MessageList/MessageList.tsx:496` and `src/components/MessageList/VirtualizedMessageList.tsx:86` now forward `reactionDetailsSort`
20002000
- `src/components/Reactions/MessageReactions.tsx:26` through `:40` accept `reaction_groups`, `reactionDetailsSort`, and the narrowed current props only
20012001
- `src/components/Reactions/MessageReactionsDetail.tsx:19` through `:26` accept `reactionDetailsSort` and `reactionGroups`, with no `sort` / `sortReactionDetails` migration path
20022002
- `src/components/Reactions/hooks/useProcessReactions.tsx:10` through `:13` now accept only `own_reactions`, `reaction_groups`, `reactions`, and `sortReactions`
20032003
- `src/components/Reactions/types.ts` no longer exports `ReactionDetailsComparator`
20042004
- Replacement:
2005-
- replace `sortReactionDetails` with `reactionDetailsSort` and pass a server-side `ReactionSort` object instead of a client comparator
2005+
- replace `sortReactionDetails` with `reactionDetailsSort` and pass a server-side `SortParamRequest[]` array instead of a client comparator
20062006
- replace `reaction_counts` with `reaction_groups`
20072007
- move `reactionOptions` configuration to `<WithComponents overrides={{ reactionOptions }}>`
20082008
- update any custom `useProcessReactions` wrappers to the narrower parameter type

β€Žexamples/tutorial/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"emoji-mart": "^5.6.0",
1717
"react": "^19.2.6",
1818
"react-dom": "^19.2.6",
19-
"stream-chat": "10.0.0-rc.5",
19+
"stream-chat": "10.0.0-rc.6",
2020
"stream-chat-react": "workspace:^"
2121
},
2222
"devDependencies": {

β€Žexamples/tutorial/src/3-channel-list/App.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useEffect } from 'react';
2-
import type { ChannelFilters, ChannelSort, ClientUser } from 'stream-chat';
2+
import type { ChannelFilters, ClientUser, SortParamRequest } from 'stream-chat';
33
import { ChannelPaginator } from 'stream-chat';
44
import {
55
Channel,
@@ -22,7 +22,7 @@ const user: ClientUser = {
2222
image: `https://getstream.io/random_png/?name=${userName}`,
2323
};
2424

25-
const sort: ChannelSort = [{ direction: -1, field: 'last_message_at' }];
25+
const sort: SortParamRequest[] = [{ direction: -1, field: 'last_message_at' }];
2626
const filters: ChannelFilters = {
2727
type: 'messaging',
2828
members: { $in: [userId] },

β€Žexamples/vite/package.jsonβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"modern-normalize": "^3.0.1",
1818
"react": "^19.2.6",
1919
"react-dom": "^19.2.6",
20-
"stream-chat": "10.0.0-rc.5",
20+
"stream-chat": "10.0.0-rc.6",
2121
"stream-chat-react": "workspace:^"
2222
},
2323
"devDependencies": {

β€Žexamples/vite/src/App.tsxβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
import type {
1010
ChannelFilters,
1111
ChannelPaginatorRequestOptions,
12-
ChannelSort,
1312
LocalMessage,
13+
SortParamRequest,
1414
TextComposerMiddleware,
1515
} from 'stream-chat';
1616
import {
@@ -128,7 +128,7 @@ const requestOptions: ChannelPaginatorRequestOptions = {
128128
state: true,
129129
};
130130

131-
const sort: ChannelSort = [
131+
const sort: SortParamRequest[] = [
132132
{ direction: -1, field: 'pinned_at' },
133133
{ direction: -1, field: 'last_message_at' },
134134
{ direction: -1, field: 'updated_at' },

β€Žexamples/vite/src/AppSettings/ActionsMenu/ServerSideClientPromptDialog/serverSideClient.tsβ€Ž

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ export const createServerSideClient = async ({
7979
// Not `getInstance` β€” that would hand back (and mutate) the app's user-authenticated singleton.
8080
const client = new StreamChat(apiKey, { allowServerSideConnect: true });
8181

82-
client.tokenManager.secret = secret;
8382
client.tokenManager.token = token;
8483
client.tokenManager.type = 'static';
8584

β€Žexamples/vite/vite.config.tsβ€Ž

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,24 @@ export default defineConfig(({ mode }) => {
8585
// Keep local `stream-chat` out of Vite's prebundle so the browser loads the
8686
// SDK build directly and DevTools can follow its sourcemaps back to source files.
8787
// Its local ESM build still imports a few CommonJS deps that need Vite interop.
88-
include: ['base64-js', 'form-data', 'isomorphic-ws', 'axios'],
88+
include: [
89+
'base64-js',
90+
'form-data',
91+
'isomorphic-ws',
92+
'axios',
93+
// The shared i18n layer in `stream-chat` pulls in dayjs, which ships as a
94+
// UMD bundle with no ESM entry. Excluded deps are not crawled by the
95+
// dep scanner, so these have to be named explicitly to get CJS interop.
96+
'dayjs',
97+
'dayjs/plugin/calendar.js',
98+
'dayjs/plugin/duration.js',
99+
'dayjs/plugin/localeData.js',
100+
'dayjs/plugin/localizedFormat.js',
101+
'dayjs/plugin/relativeTime.js',
102+
'dayjs/plugin/timezone.js',
103+
'dayjs/plugin/updateLocale.js',
104+
'dayjs/plugin/utc.js',
105+
],
89106
exclude: localStreamChatEntry ? ['stream-chat'] : [],
90107
},
91108
server: {

β€Žpackage.jsonβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"modern-normalize": "^3.0.1",
130130
"react": "^19.0.0 || ^18.0.0 || ^17.0.0",
131131
"react-dom": "^19.0.0 || ^18.0.0 || ^17.0.0",
132-
"stream-chat": "10.0.0-rc.5"
132+
"stream-chat": "10.0.0-rc.6"
133133
},
134134
"peerDependenciesMeta": {
135135
"@breezystack/lamejs": {
@@ -199,7 +199,7 @@
199199
"react-dom": "^19.2.6",
200200
"sass": "^1.100.0",
201201
"semantic-release": "^25.0.3",
202-
"stream-chat": "10.0.0-rc.5",
202+
"stream-chat": "10.0.0-rc.6",
203203
"typescript": "^6.0.3",
204204
"typescript-eslint": "^8.59.4",
205205
"vite": "^8.1.3",

0 commit comments

Comments
Β (0)