Skip to content

Commit 8ed7ea6

Browse files
committed
chore: fixes in migration guide
1 parent 620ffe5 commit 8ed7ea6

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

‎projects/stream-chat-angular/migration-guide.md‎

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ The method signature is unchanged, but it now uses `stream-chat` v10's message p
212212

213213
### Channel preview
214214

215-
`ChannelPreviewComponent.latestMessage` (and `ChannelPreviewInfoContext.latestMessage`) changed from `FormatMessageResponse` to `LocalMessage` (dates are `TimestampNS`). The latest message now comes from `channel.messagePaginator`, so custom channel preview templates no longer need `message.new` / `message.updated` / `message.deleted` listeners to stay up to date.
215+
`ChannelPreviewComponent.latestMessage` changed from `FormatMessageResponse` to `LocalMessage`, and `ChannelPreviewInfoContext.latestMessage` changed from `StreamMessage` to `LocalMessage` (dates are `TimestampNS`, and there are no `readBy` and `translation` fields). The latest message now comes from `channel.messagePaginator`, so custom channel preview templates no longer need `message.new` / `message.updated` / `message.deleted` listeners to stay up to date.
216216

217217
## Threads
218218

@@ -268,6 +268,7 @@ In v10, attachment metadata moved under `attachment.custom`. This includes the f
268268
- `DefaultAttachmentData` has two new fields, `duration` and `waveform_data`.
269269
- If you have custom attachment templates, read the fields from their new location.
270270
- Custom upload/delete handlers (`customImageUploadRequest`, `customFileUploadRequest`, `customImageDeleteRequest`, `customFileDeleteRequest`) are unchanged. The default upload requests now use `channel.uploadImage` / `uploadFile` (`channel.sendImage` / `sendFile` were removed in v10).
271+
- `AttachmentListComponent` now compares attachment URLs without their query string. Attachment URLs are signed, and some message updates (for example adding a reaction) renew the signature, so `message.attachments` can change even if the attachments are the same. `AttachmentListComponent` ignores these changes, so images and videos aren't reloaded. If you display attachments with your own component instead of `stream-attachment-list`, you may want to do the same.
271272

272273
## Message input and drafts
273274

@@ -302,15 +303,19 @@ v10 messages no longer have `moderation_details`. Bounced messages are detected
302303

303304
## Other type changes
304305

305-
| Type / API | Before | After |
306-
| ------------------------------------------------ | --------------------------------------------------------------- | ----------------------------------------------------------------------- |
307-
| `ChatClientService.appSettings$` / `AppSettings` | `AppSettings` from `stream-chat` | `AppSettings` from `stream-chat-angular` (`Partial<AppResponseFields>`) |
308-
| `ChannelService.activeChannelMessages` getter | `(StreamMessage \| MessageResponse \| FormatMessageResponse)[]` | `(StreamMessage \| MessageResponse \| LocalMessage)[]` |
309-
| `ChannelService.selectMessageToQuote` | `StreamMessage \| MessageResponse \| undefined` | also accepts `LocalMessage` |
310-
| `MessageTextContext.message` | `StreamMessage \| MessageResponseBase \| undefined` | `StreamMessage \| MessageResponse \| undefined` |
311-
| `ChannelSort` | from `stream-chat` | removed, use `SortParamRequest[]` from `stream-chat` |
312-
| `getChannelDisplayText(channel, user)` | `user: UserResponse` | `user?: { id?: string }` |
313-
| `listUsers(users)` | `users: UserResponse[]` | `users: { id: string; name?: string }[]` |
306+
| Type / API | Before | After |
307+
| ------------------------------------------------------------------------------- | --------------------------------------------------------------- | ----------------------------------------------------------------------- |
308+
| `ChatClientService.appSettings$` / `AppSettings` | `AppSettings` from `stream-chat` | `AppSettings` from `stream-chat-angular` (`Partial<AppResponseFields>`) |
309+
| `ChannelService.activeChannelMessages` getter | `(StreamMessage \| MessageResponse \| FormatMessageResponse)[]` | `(StreamMessage \| MessageResponse \| LocalMessage)[]` |
310+
| `ChannelService.selectMessageToQuote` | `StreamMessage \| MessageResponse \| undefined` | also accepts `LocalMessage` |
311+
| `MessageTextContext.message` | `StreamMessage \| MessageResponseBase \| undefined` | `StreamMessage \| MessageResponse \| undefined` |
312+
| `ChannelSort` | from `stream-chat` | removed, use `SortParamRequest[]` from `stream-chat` |
313+
| `getChannelDisplayText(channel, user)` | `user: UserResponse` | `user?: { id?: string }` |
314+
| `listUsers(users)` | `users: UserResponse[]` | `users: { id: string; name?: string }[]` |
315+
| `AvatarComponent.user`, `AvatarPlaceholderComponent.user`, `AvatarContext.user` | `User` | `UserResponse` |
316+
| `getReadBy(message, channel)` | `message: FormatMessageResponse` | `message: Pick<MessageResponse, 'created_at' \| 'user'>` |
317+
| `createMessagePreview(...)` | returns `MessageResponse` | returns `LocalMessage` (`customData` is set as `custom`) |
318+
| `MessageListComponent.parseDate` | `parseDate(date: Date)` | `parseDate(timestamp: TimestampNS)` |
314319

315320
## Translations
316321

@@ -322,15 +327,16 @@ These changes don't require code changes, but your app may behave differently:
322327

323328
- **Reconnect:** after a reconnect, the SDK refreshes the channel list (same as before), and `stream-chat` reloads the active channel and the open thread. The open thread now stays open (previously it was closed because its replies weren't reloaded).
324329
- **Message list updates:** messages arriving via WebSocket can be displayed up to 500 ms later: `stream-chat` v10 batches message list updates. Messages sent by the current user are displayed immediately.
325-
- **Message objects:** when a message changes (for example a reaction is added), only that message gets a new object in `activeChannelMessages$`. Attachments are kept if only their (signed) URLs changed, so images and videos aren't reloaded.
330+
- **Message objects:** when a message changes (for example a reaction is added), only that message gets a new object in `activeChannelMessages$`.
326331
- **Hard deleted user messages:** in v10, `user.messages.deleted` events with `hard_delete` remove the messages instead of displaying a "This message was deleted" placeholder.
327332
- **Read events:** the active channel is marked as read with `channel.markReadViaReporter()` (v9's `markRead` behavior). If read events are disabled for the channel, the SDK doesn't send read requests, and mark as unread fails with an error notification.
328333
- **Typing events** are only sent if typing events are enabled for the channel (`channel.config.typingEvents.enabled`).
329334

330335
## New APIs
331336

332337
- `ChannelService.activeChannelMessagesPaginationState$` and `activeThreadMessagesPaginationState$`: pagination state of the message lists (`MessageListPaginationState`: `hasMoreOlder`, `hasMoreNewer`, `isLoading`, `error`).
333-
- `ChannelService.jumpToFirstUnreadMessage()`: jumps to the first unread message of the active channel (uses `stream-chat`'s unread state).
338+
- `ChannelService.jumpToFirstUnreadMessage()`: jumps to the first unread message of the active channel (uses `stream-chat`'s unread state). Resolves to `false` if there's nothing to jump to. If the message can't be loaded, the promise rejects and the "Message not found" notification is displayed.
339+
- `getTranslationLanguage(channel, user)`: the language messages are translated to (the user's `language`, or the channel's `auto_translation_language`). The SDK now updates message translations when either of them changes.
334340
- `ChannelService.reloadActiveChannelMessages()`: retries loading the messages of the active channel (for example after an error).
335341
- `MessageListPaginationState` and `AppSettings` types.
336342

0 commit comments

Comments
 (0)