|
| 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 |
0 commit comments