Skip to content

Commit b6a220c

Browse files
committed
docs(ai-migration): fix signature/prop claims; prefer /css/* alias
Four SDK-mismatch fixes surfaced by validating the guide against node_modules/stream-chat-react/dist/types: - Hook name: useMessageComposer β†’ useMessageComposerController. The former does not exist in v14. The human migration guide had the correct name; the AI guide had a hallucination. - usePinHandler v14 signature is (message) with no second arg; notifications are published internally via useNotificationApi(). - FileIcon props: `size` is not removed, only retyped from number to FileIconSize ('sm' | 'md' | 'lg' | 'xl'); new `sizeConfig` prop exists. Only `big`, `sizeSmall`, `type` were removed. - ModalGalleryProps: no `initialIndex`. Actual props are { items, className?, modalClassName?, closeOnBackgroundClick? }. Also recommend the /css/* alias over /dist/css/* for stylesheet imports: package.json exports map aliases it, so consumers do not need to depend on the internal dist/ layout.
1 parent 03c3118 commit b6a220c

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ Required workflow:
2525
1. Upgrade both packages to their latest versions together. The v14 peer-dep floor moved; leaving `stream-chat` on a v13-era version will fail peer resolution.
2626
- `stream-chat-react` β†’ latest v14
2727
- `stream-chat` β†’ latest
28-
2. Update stylesheet imports. The `/v2` path no longer resolves.
28+
2. Update stylesheet imports. The `/v2` path no longer resolves. Prefer the aliased `stream-chat-react/css/*` path over `stream-chat-react/dist/css/*` β€” the alias is defined in the package's `exports` map and hides the internal `dist/` layout.
2929
```ts
3030
// before
3131
import 'stream-chat-react/dist/css/v2/index.css';
3232
// after
33-
import 'stream-chat-react/dist/css/index.css';
33+
import 'stream-chat-react/css/index.css';
3434
```
3535
3. If the app uses `EmojiPicker`, also import its dedicated stylesheet:
3636
```ts
37-
import 'stream-chat-react/dist/css/emoji-picker.css';
37+
import 'stream-chat-react/css/emoji-picker.css';
3838
```
3939

4040
---
@@ -118,10 +118,10 @@ const VirtualMessage = (props: MessageUIComponentProps) => <CustomMessage {...pr
118118

119119
```tsx
120120
// customize preview via EditedMessagePreview in WithComponents
121-
import { useMessageComposer, useMessageContext } from 'stream-chat-react';
121+
import { useMessageComposerController, useMessageContext } from 'stream-chat-react';
122122

123123
const { message } = useMessageContext();
124-
const messageComposer = useMessageComposer();
124+
const messageComposer = useMessageComposerController();
125125

126126
messageComposer.initState({ composition: message }); // start
127127
messageComposer.clear(); // cancel
@@ -172,7 +172,7 @@ For richer rendering, override `QuotedMessage` or `QuotedMessagePreview` in `Wit
172172
- `useChannelDeletedListener`, `useNotificationMessageNewListener`, `useMobileNavigation`, siblings β†’ no shim; remove the calls (`ChannelList` handles these events internally)
173173
- `ToggleSidebarButton`, `ToggleButtonIcon`, `MenuIcon`, `NAV_SIDEBAR_DESKTOP_BREAKPOINT` β†’ app-owned sidebar (see Phase 6)
174174
- `pinPermissions`, `PinPermissions`, `PinEnabledUserRoles`, `defaultPinPermissions` β†’ rely on `channelCapabilities['pin-message']`; remove the props
175-
- `usePinHandler(message, pinPermissions, notifications)` β†’ `usePinHandler(message, notifications?)`
175+
- `usePinHandler(message, pinPermissions, notifications)` β†’ `usePinHandler(message)` (no second argument; notifications are published via `useNotificationApi()` internally)
176176
- `ChannelListItemUI.latestMessage` β†’ `latestMessagePreview`
177177
- `EmojiPicker.popperOptions` β†’ `placement`
178178
- `InfiniteScroll` / `LoadMoreButton` / `LoadMorePaginator`: `hasMore`, `loadMore`, `refreshing` β†’ `hasNextPage`, `loadNextPage`, `isLoading`
@@ -379,8 +379,8 @@ To preserve the old blank pane, override `EmptyStateIndicator` with a `null`-ret
379379
- **`ChannelAvatar` / `GroupAvatar`.** `groupChannelDisplayInfo` array of `{image, name}` β†’ `displayMembers`; `size` required.
380380
- **`useChannelPreviewInfo()`** returns a stable empty group info object instead of `null`/`undefined` β€” any `groupChannelDisplayInfo == null` checks are now always false.
381381
- **`useLatestMessagePreview()`** reports native `giphy` attachments with `type: 'giphy'`, not `image`.
382-
- **`FileIcon` props.** `filename` β†’ `fileName`; `big`, `size`, `sizeSmall`, `type` removed. `mimeTypeToIcon(type, mimeType)` β†’ `mimeTypeToIcon(mimeType?)`.
383-
- **`Gallery` / `ModalGallery`.** `ModalGallery` API went from `{ images, index }` to `{ items, initialIndex? }`. `Gallery` alone no longer renders a thumbnail grid β€” supply `GalleryUI` or use `ModalGallery` for the old behavior.
382+
- **`FileIcon` props.** `filename` β†’ `fileName`; `big`, `sizeSmall`, `type` removed. `size` is retyped from a pixel number to `FileIconSize` (`'sm' | 'md' | 'lg' | 'xl'`); new `sizeConfig` prop allows overriding per-size dimensions. `mimeTypeToIcon(type, mimeType)` β†’ `mimeTypeToIcon(mimeType?)`.
383+
- **`Gallery` / `ModalGallery`.** `ModalGallery` API went from `{ images, index }` to `{ items }` (also accepts `className`, `modalClassName`, `closeOnBackgroundClick`). `Gallery` alone no longer renders a thumbnail grid β€” supply `GalleryUI` or use `ModalGallery` for the old behavior.
384384
- **Low-level attachment containers.** `MediaContainer` now takes `attachments` (plural). Gallery payloads changed `images` β†’ `items`. Audio custom components: rename prop `og` β†’ `attachment`. Native `giphy` stays inline (no `ModalGallery` expansion).
385385
- **`AttachmentProps.Gallery` β†’ `AttachmentProps.ModalGallery`.** `Media` now uses `VideoPlayerProps`, not `ReactPlayerProps`.
386386
- **`PinIndicator`** no longer receives `t` as prop β€” use `useTranslationContext()` inside.
@@ -392,7 +392,7 @@ To preserve the old blank pane, override `EmptyStateIndicator` with a `null`-ret
392392

393393
## Phase 8 β€” CSS, DOM, and Selector Audit
394394

395-
- `stream-chat-react/dist/css/v2/*` β†’ `stream-chat-react/dist/css/*`
395+
- `stream-chat-react/dist/css/v2/*` β†’ `stream-chat-react/css/*` (preferred alias) or `stream-chat-react/dist/css/*`
396396
- `.str-chat__modal__inner` β†’ removed; children render directly
397397
- `.str-chat__channel-list-messenger` β†’ `.str-chat__channel-list-inner`
398398
- `.str-chat__channel-list-messenger__main` β†’ `.str-chat__channel-list-inner__main`

0 commit comments

Comments
Β (0)