Skip to content

Commit 8317b73

Browse files
refactor!: remove deprecated APIs ahead of v14 stable (#3086)
### 🎯 Goal Remove 19 deprecated APIs that have accumulated over multiple major versions (some since v10) before the v14 stable release. This reduces public API surface area and eliminates dead code paths, fallback patterns, and runtime deprecation warnings. ### πŸ›  Implementation details Removed items grouped by category: **Pin Permissions (7 items)** - `pinPermissions` prop from `MessageContext`, `MessageProps`, `MessageListProps` - `PinEnabledUserRoles` and `PinPermissions` types - `defaultPinPermissions` constant - `_permissions` param from `usePinHandler` (signature is now `(message, notifications)`) **Pagination Renames (6 items, #1804)** - `hasMore`, `hasMoreNewer`, `loadMore`, `loadMoreNewer` from `InfiniteScroll` β€” use `hasPreviousPage`, `hasNextPage`, `loadPreviousPage`, `loadNextPage` - `refreshing` from `LoadMoreButton`, `LoadMorePaginator`, `PaginatorProps` β€” use `isLoading` - Removed `deprecationAndReplacementWarning` utility (zero callers remain) **Components & Exports (4 items)** - Deleted `StreamEmoji` component - Renamed `UploadButton`/`UploadButtonProps` exports to `FileInput`/`FileInputProps` - Removed `latestMessage` prop from `ChannelListItemUI` β€” use `latestMessagePreview` - Removed `popperOptions` prop from `EmojiPicker` β€” use `placement` **Utilities (2 items)** - Deleted `moveChannelUp` (replaced by `moveChannelUpwards`); updated `useMessageNewListener` - Deleted `hasNotMoreMessages` (negated duplicate of `hasMoreMessagesProbably`) **ChannelList Event Listener Hooks (10 items)** - Deleted `useChannelDeletedListener`, `useChannelHiddenListener`, `useChannelTruncatedListener`, `useChannelUpdatedListener`, `useChannelVisibleListener`, `useMessageNewListener`, `useNotificationAddedToChannelListener`, `useNotificationMessageNewListener`, `useNotificationRemovedFromChannelListener`, `useUserPresenceChangedListener` - These hooks were standalone event listeners consuming `ChannelList` callback props (e.g. `onChannelDeleted`, `onMessageNew`, etc.) β€” channel list event handling is now managed internally by the `stream-chat` SDK's `ChannelManager` **Bug fix** - Fixed wrong deprecation comment on `MessageList.tsx` where `loadMoreNewer` was incorrectly labeled as deprecated See `ai-docs/DEPRECATED_API_REMOVAL_PLAN.md` for the full inventory and remaining items. ### ⚠ Breaking Changes | Removed API | Replacement | | ------------------------------------------------ | ---------------------------------------------------- | | `pinPermissions` prop | `channelCapabilities` (already used at runtime) | | `PinPermissions`, `PinEnabledUserRoles` types | `channelCapabilities` | | `defaultPinPermissions` constant | `channelCapabilities` | | `usePinHandler(msg, permissions, notifications)` | `usePinHandler(msg, notifications)` | | `hasMore` / `hasMoreNewer` (InfiniteScroll) | `hasPreviousPage` / `hasNextPage` | | `loadMore` / `loadMoreNewer` (InfiniteScroll) | `loadPreviousPage` / `loadNextPage` | | `refreshing` (LoadMoreButton, PaginatorProps) | `isLoading` | | `StreamEmoji` component | (removed, no replacement) | | `moveChannelUp` utility | `moveChannelUpwards` | | `UploadButton` / `UploadButtonProps` | `FileInput` / `FileInputProps` | | `latestMessage` prop (ChannelListItemUI) | `latestMessagePreview` | | `popperOptions` prop (EmojiPicker) | `placement` | | `hasNotMoreMessages` | `hasMoreMessagesProbably` | | `useChannelDeletedListener` hook | Channel list events handled by `useChannelListShape` | | `useChannelHiddenListener` hook | -//- | | `useChannelTruncatedListener` hook | -//- | | `useChannelUpdatedListener` hook | -//- | | `useChannelVisibleListener` hook | -//- | | `useMessageNewListener` hook | -//- | | `useNotificationAddedToChannelListener` hook | -//- | | `useNotificationMessageNewListener` hook | -//- | | `useNotificationRemovedFromChannelListener` hook | -//- | | `useUserPresenceChangedListener` hook | -//- | ### 🎨 UI Changes No visual changes β€” all removals are API-only. --------- Co-authored-by: Anton Arnautov <arnautov.anton@gmail.com> Co-authored-by: Anton Arnautov <43254280+arnautov-anton@users.noreply.github.com>
1 parent 30e45fa commit 8317b73

35 files changed

+139
-787
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Deprecated API Removal Plan
2+
3+
## Context
4+
5+
The SDK (currently at v14 beta) has **31 deprecated items** accumulated over several major versions. Some have been deprecated since v10 ("will be removed in v11.0.0"). Since v14 is still in beta, now is the ideal time to clean these up before stable release. All removals are breaking changes, but they're expected in a major version bump.
6+
7+
## Inventory
8+
9+
| # | Deprecated Item | Replacement | Location | Status |
10+
| ---------------------------------------------------------- | ---------------------------------------- | ------------------------------------------- | ----------------------------------------------------------- | ---------------- |
11+
| **Pin Permissions (7 items)** | | | | |
12+
| 1 | `pinPermissions` prop (MessageContext) | `channelCapabilities` | `src/context/MessageContext.tsx` | βœ… Done |
13+
| 2 | `pinPermissions` prop (MessageProps) | `channelCapabilities` | `src/components/Message/types.ts` | βœ… Done |
14+
| 3 | `pinPermissions` prop (MessageListProps) | `channelCapabilities` | `src/components/MessageList/MessageList.tsx` | βœ… Done |
15+
| 4 | `PinEnabledUserRoles` type | `channelCapabilities` | `src/components/Message/hooks/usePinHandler.ts` | βœ… Done |
16+
| 5 | `PinPermissions` type | `channelCapabilities` | `src/components/Message/hooks/usePinHandler.ts` | βœ… Done |
17+
| 6 | `defaultPinPermissions` constant | `channelCapabilities` | `src/components/Message/utils.tsx` | βœ… Done |
18+
| 7 | `_permissions` param in `usePinHandler` | `channelCapabilities` | `src/components/Message/hooks/usePinHandler.ts` | βœ… Done |
19+
| **Pagination Renames (6 items, #1804)** | | | | |
20+
| 8 | `hasMore` prop (InfiniteScroll) | `hasPreviousPage` | `src/components/InfiniteScrollPaginator/InfiniteScroll.tsx` | βœ… Done |
21+
| 9 | `hasMoreNewer` prop (InfiniteScroll) | `hasNextPage` | `src/components/InfiniteScrollPaginator/InfiniteScroll.tsx` | βœ… Done |
22+
| 10 | `loadMore` prop (InfiniteScroll) | `loadPreviousPage` | `src/components/InfiniteScrollPaginator/InfiniteScroll.tsx` | βœ… Done |
23+
| 11 | `loadMoreNewer` prop (InfiniteScroll) | `loadNextPage` | `src/components/InfiniteScrollPaginator/InfiniteScroll.tsx` | βœ… Done |
24+
| 12 | `refreshing` prop (LoadMoreButton) | `isLoading` | `src/components/LoadMore/LoadMoreButton.tsx` | βœ… Done |
25+
| 13 | `refreshing` prop (PaginatorProps) | `isLoading` | `src/types/types.ts` | βœ… Done |
26+
| **useUserRole (3 items)** | | | | |
27+
| 14 | `isAdmin` return value | `channelCapabilities` | `src/components/Message/hooks/useUserRole.ts:13` | Pending |
28+
| 15 | `isOwner` return value | `channelCapabilities` | `src/components/Message/hooks/useUserRole.ts:20` | Pending |
29+
| 16 | `isModerator` return value | `channelCapabilities` | `src/components/Message/hooks/useUserRole.ts:26` | Pending |
30+
| **VirtualizedMessageList (4 items, deprecated since v10)** | | | | |
31+
| 17 | `defaultItemHeight` prop | `additionalVirtuosoProps.defaultItemHeight` | `VirtualizedMessageList.tsx:617` | Pending |
32+
| 18 | `head` prop | `additionalVirtuosoProps.components.Header` | `VirtualizedMessageList.tsx:636` | Pending |
33+
| 19 | `overscan` prop | `additionalVirtuosoProps.overscan` | `VirtualizedMessageList.tsx:663` | Pending |
34+
| 20 | `scrollSeekPlaceHolder` prop | `additionalVirtuosoProps.scrollSeek*` | `VirtualizedMessageList.tsx:675` | Pending |
35+
| **Other** | | | | |
36+
| 21 | `StreamEmoji` component | (none) | `src/components/Reactions/StreamEmoji.tsx` | βœ… Done |
37+
| 22 | `UploadButton` / `UploadButtonProps` | `FileInput` / `FileInputProps` | `src/components/ReactFileUtilities/UploadButton.tsx` | βœ… Done |
38+
| 23 | `moveChannelUp` utility | `moveChannelUpwards` | `src/components/ChannelList/utils.ts` | βœ… Done |
39+
| 24 | `latestMessage` prop | `latestMessagePreview` | `src/components/ChannelListItem/ChannelListItem.tsx` | βœ… Done |
40+
| 25 | `total_unread_count` mock field | `unread_count` | `src/mock-builders/event/notificationMarkUnread.ts` | βœ… Done |
41+
| 26 | `hasNotMoreMessages` function | `hasMoreMessagesProbably` | `src/components/MessageList/utils.ts` | βœ… Done |
42+
| 27 | `popperOptions` prop (EmojiPicker) | `placement` | `src/plugins/Emojis/EmojiPicker.tsx` | βœ… Done |
43+
| 28 | `useActionHandler` string overload | `FormData` object form | `src/components/Message/hooks/useActionHandler.ts:34` | Pending |
44+
| 29 | `formatDate` prop (MessageProps) | (TBD) | `src/components/Message/types.ts:29` (`// todo: remove`) | Pending |
45+
| 30 | `LegacyReactionOptions` array format | Object format `{ quick: {...} }` | `src/components/Reactions/reactionOptions.tsx:5` | Needs discussion |
46+
| 31 | `LegacyThreadContext` | (internal plumbing, not public API) | `src/components/Thread/LegacyThreadContext.ts` | Needs discussion |
47+
48+
## Bug Fix (not a removal)
49+
50+
~~`MessageList.tsx:83` has a **wrong deprecation comment**: `loadMoreNewer` is labeled `@deprecated in favor of channelCapabilities` but it's a pagination callback, not related to capabilities. This comment was copy-pasted from pin permissions deprecation and should be removed.~~ βœ… Fixed
51+
52+
## Also addressed
53+
54+
- `deprecationAndReplacementWarning` utility deleted (zero callers remain after Batch 3)
55+
- Tests updated: `InfiniteScroll.test.tsx`, `LoadMoreButton.test.tsx`, `LoadMorePaginator.test.tsx`
56+
- Unused `fireEvent` import cleaned up in `InfiniteScroll.test.tsx`
57+
58+
## Remaining Work
59+
60+
### Batch 4 (remaining): useUserRole (items 14–16)
61+
62+
**Risk: Medium**
63+
64+
| Action | File |
65+
| ----------------------------------------------------------------- | ------------------------------------------------------------- |
66+
| Remove `isAdmin`, `isOwner`, `isModerator` computations + returns | `src/components/Message/hooks/useUserRole.ts` |
67+
| Delete ~120 lines of tests for removed values | `src/components/Message/hooks/__tests__/useUserRole.test.tsx` |
68+
69+
### Batch 5: VirtualizedMessageList Props (items 17–20)
70+
71+
**Risk: Medium-High** β€” Deprecated since v10. The `head` prop needs care since it may affect thread rendering.
72+
73+
| Action | File |
74+
| ----------------------------------------------------------------------- | ------------------------------------------------------- |
75+
| Remove `defaultItemHeight` prop + Virtuoso spread | `src/components/MessageList/VirtualizedMessageList.tsx` |
76+
| Remove `head` prop + rendering logic (verify thread headers still work) | `src/components/MessageList/VirtualizedMessageList.tsx` |
77+
| Remove `overscan` prop + Virtuoso prop | `src/components/MessageList/VirtualizedMessageList.tsx` |
78+
| Remove `scrollSeekPlaceHolder` prop + Virtuoso config | `src/components/MessageList/VirtualizedMessageList.tsx` |
79+
80+
### Batch 6: Misc Cleanup (items 28, 29)
81+
82+
**Risk: Medium**
83+
84+
| Action | File |
85+
| ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
86+
| Remove string overload branch (`typeof dataOrName === 'string'`) | `src/components/Message/hooks/useActionHandler.ts` |
87+
| Update `ActionHandlerReturnType` to only accept `FormData` | `src/components/Message/hooks/useActionHandler.ts` |
88+
| Update tests if any use the string overload | `src/components/Message/hooks/__tests__/useActionHandler.test.tsx` |
89+
| Remove `formatDate` prop from `MessageProps` and `MessageContextValue` (has `// todo: remove`) | `src/components/Message/types.ts`, `src/context/MessageContext.tsx` |
90+
| Remove `formatDate` pass-through in Message component and i18n integration | `src/i18n/utils.ts`, `src/i18n/types.ts` |
91+
| **Note:** `DateSeparator.formatDate` is a separate prop and should be kept | |
92+
93+
### Batch 7: Legacy Formats (items 30, 31) β€” Needs Discussion
94+
95+
**Risk: High** β€” These are not formally `@deprecated` but are named "Legacy" and have newer replacements. Removal is more invasive.
96+
97+
| Item | Details |
98+
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
99+
| `LegacyReactionOptions` array format | The `ReactionOptions` type is a union of `LegacyReactionOptions` (array) and the new object format. Removing the array branch requires updating `Array.isArray()` guards in `ReactionSelector.tsx`, `useProcessReactions.tsx`, `MessageReactionsDetail.tsx`, and tests. |
100+
| `LegacyThreadContext` | Internal compatibility bridge used in `Thread.tsx`, `useMessageComposerController.ts`, `useNotificationTarget.ts`, and tests. Named "Legacy" explicitly. Not a public API β€” removal depends on whether the new thread model fully replaces it. |
101+
102+
**Recommendation:** These warrant their own investigation before committing to removal in v14. They may be better suited for v15 unless the team confirms the newer alternatives fully cover all use cases.
103+
104+
## Items to NOT Remove
105+
106+
| Item | Reason |
107+
| ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
108+
| `hasMore`/`hasMoreNewer`/`loadMore`/`loadMoreNewer` on **MessageList** and **VirtualizedMessageList** | NOT deprecated β€” canonical API from ChannelStateContext/ChannelActionContext |
109+
| `_componentName` params on context hooks | Backward-compatible call-site markers, no benefit to removing |
110+
111+
## Verification (per batch)
112+
113+
1. `yarn types` β€” No type errors from removed types/props
114+
2. `yarn test` β€” Full test suite passes
115+
3. `yarn build` β€” Build succeeds
116+
4. `yarn lint-fix` β€” No lint issues
117+
5. For Batch 5: manually verify thread rendering in the example app
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
1-
export * from './useChannelDeletedListener';
2-
export * from './useChannelHiddenListener';
3-
export * from './useChannelTruncatedListener';
4-
export * from './useChannelUpdatedListener';
5-
export * from './useChannelVisibleListener';
61
export * from './useConnectionRecoveredListener';
7-
export * from './useMessageNewListener';
82
export * from './useMobileNavigation';
9-
export * from './useNotificationAddedToChannelListener';
10-
export * from './useNotificationMessageNewListener';
11-
export * from './useNotificationRemovedFromChannelListener';
123
export * from './usePaginatedChannels';
13-
export * from './useUserPresenceChangedListener';
144
export * from './useChannelMembershipState';
155
export * from './useChannelMembersState';

β€Žsrc/components/ChannelList/hooks/useChannelDeletedListener.tsβ€Ž

Lines changed: 0 additions & 39 deletions
This file was deleted.

β€Žsrc/components/ChannelList/hooks/useChannelHiddenListener.tsβ€Ž

Lines changed: 0 additions & 38 deletions
This file was deleted.

β€Žsrc/components/ChannelList/hooks/useChannelTruncatedListener.tsβ€Ž

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
Β (0)