-
Notifications
You must be signed in to change notification settings - Fork 295
refactor!: remove deprecated APIs ahead of v14 stable #3086
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
oliverlaz
wants to merge
2
commits into
master
Choose a base branch
from
refactor/remove-deprecated-apis
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| # Deprecated API Removal Plan | ||
|
|
||
| ## Context | ||
|
|
||
| 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. | ||
|
|
||
| ## Inventory | ||
|
|
||
| | # | Deprecated Item | Replacement | Location | Status | | ||
| | ---------------------------------------------------------- | ---------------------------------------- | ------------------------------------------- | ----------------------------------------------------------- | ---------------- | | ||
| | **Pin Permissions (7 items)** | | | | | | ||
| | 1 | `pinPermissions` prop (MessageContext) | `channelCapabilities` | `src/context/MessageContext.tsx` | β Done | | ||
| | 2 | `pinPermissions` prop (MessageProps) | `channelCapabilities` | `src/components/Message/types.ts` | β Done | | ||
| | 3 | `pinPermissions` prop (MessageListProps) | `channelCapabilities` | `src/components/MessageList/MessageList.tsx` | β Done | | ||
| | 4 | `PinEnabledUserRoles` type | `channelCapabilities` | `src/components/Message/hooks/usePinHandler.ts` | β Done | | ||
| | 5 | `PinPermissions` type | `channelCapabilities` | `src/components/Message/hooks/usePinHandler.ts` | β Done | | ||
| | 6 | `defaultPinPermissions` constant | `channelCapabilities` | `src/components/Message/utils.tsx` | β Done | | ||
| | 7 | `_permissions` param in `usePinHandler` | `channelCapabilities` | `src/components/Message/hooks/usePinHandler.ts` | β Done | | ||
| | **Pagination Renames (6 items, #1804)** | | | | | | ||
| | 8 | `hasMore` prop (InfiniteScroll) | `hasPreviousPage` | `src/components/InfiniteScrollPaginator/InfiniteScroll.tsx` | β Done | | ||
| | 9 | `hasMoreNewer` prop (InfiniteScroll) | `hasNextPage` | `src/components/InfiniteScrollPaginator/InfiniteScroll.tsx` | β Done | | ||
| | 10 | `loadMore` prop (InfiniteScroll) | `loadPreviousPage` | `src/components/InfiniteScrollPaginator/InfiniteScroll.tsx` | β Done | | ||
| | 11 | `loadMoreNewer` prop (InfiniteScroll) | `loadNextPage` | `src/components/InfiniteScrollPaginator/InfiniteScroll.tsx` | β Done | | ||
| | 12 | `refreshing` prop (LoadMoreButton) | `isLoading` | `src/components/LoadMore/LoadMoreButton.tsx` | β Done | | ||
| | 13 | `refreshing` prop (PaginatorProps) | `isLoading` | `src/types/types.ts` | β Done | | ||
| | **useUserRole (3 items)** | | | | | | ||
| | 14 | `isAdmin` return value | `channelCapabilities` | `src/components/Message/hooks/useUserRole.ts:13` | Pending | | ||
| | 15 | `isOwner` return value | `channelCapabilities` | `src/components/Message/hooks/useUserRole.ts:20` | Pending | | ||
| | 16 | `isModerator` return value | `channelCapabilities` | `src/components/Message/hooks/useUserRole.ts:26` | Pending | | ||
| | **VirtualizedMessageList (4 items, deprecated since v10)** | | | | | | ||
| | 17 | `defaultItemHeight` prop | `additionalVirtuosoProps.defaultItemHeight` | `VirtualizedMessageList.tsx:617` | Pending | | ||
| | 18 | `head` prop | `additionalVirtuosoProps.components.Header` | `VirtualizedMessageList.tsx:636` | Pending | | ||
| | 19 | `overscan` prop | `additionalVirtuosoProps.overscan` | `VirtualizedMessageList.tsx:663` | Pending | | ||
| | 20 | `scrollSeekPlaceHolder` prop | `additionalVirtuosoProps.scrollSeek*` | `VirtualizedMessageList.tsx:675` | Pending | | ||
| | **Other** | | | | | | ||
| | 21 | `StreamEmoji` component | (none) | `src/components/Reactions/StreamEmoji.tsx` | β Done | | ||
| | 22 | `UploadButton` / `UploadButtonProps` | `FileInput` / `FileInputProps` | `src/components/ReactFileUtilities/UploadButton.tsx` | β Done | | ||
| | 23 | `moveChannelUp` utility | `moveChannelUpwards` | `src/components/ChannelList/utils.ts` | β Done | | ||
| | 24 | `latestMessage` prop | `latestMessagePreview` | `src/components/ChannelListItem/ChannelListItem.tsx` | β Done | | ||
| | 25 | `total_unread_count` mock field | `unread_count` | `src/mock-builders/event/notificationMarkUnread.ts` | β Done | | ||
| | 26 | `hasNotMoreMessages` function | `hasMoreMessagesProbably` | `src/components/MessageList/utils.ts` | β Done | | ||
| | 27 | `popperOptions` prop (EmojiPicker) | `placement` | `src/plugins/Emojis/EmojiPicker.tsx` | β Done | | ||
| | 28 | `useActionHandler` string overload | `FormData` object form | `src/components/Message/hooks/useActionHandler.ts:34` | Pending | | ||
| | 29 | `formatDate` prop (MessageProps) | (TBD) | `src/components/Message/types.ts:29` (`// todo: remove`) | Pending | | ||
| | 30 | `LegacyReactionOptions` array format | Object format `{ quick: {...} }` | `src/components/Reactions/reactionOptions.tsx:5` | Needs discussion | | ||
| | 31 | `LegacyThreadContext` | (internal plumbing, not public API) | `src/components/Thread/LegacyThreadContext.ts` | Needs discussion | | ||
|
|
||
| ## Bug Fix (not a removal) | ||
|
|
||
| ~~`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 | ||
|
|
||
| ## Also addressed | ||
|
|
||
| - `deprecationAndReplacementWarning` utility deleted (zero callers remain after Batch 3) | ||
| - Tests updated: `InfiniteScroll.test.tsx`, `LoadMoreButton.test.tsx`, `LoadMorePaginator.test.tsx` | ||
| - Unused `fireEvent` import cleaned up in `InfiniteScroll.test.tsx` | ||
|
|
||
| ## Remaining Work | ||
|
|
||
| ### Batch 4 (remaining): useUserRole (items 14β16) | ||
|
|
||
| **Risk: Medium** | ||
|
|
||
| | Action | File | | ||
| | ----------------------------------------------------------------- | ------------------------------------------------------------- | | ||
| | Remove `isAdmin`, `isOwner`, `isModerator` computations + returns | `src/components/Message/hooks/useUserRole.ts` | | ||
| | Delete ~120 lines of tests for removed values | `src/components/Message/hooks/__tests__/useUserRole.test.tsx` | | ||
|
|
||
| ### Batch 5: VirtualizedMessageList Props (items 17β20) | ||
|
|
||
| **Risk: Medium-High** β Deprecated since v10. The `head` prop needs care since it may affect thread rendering. | ||
|
|
||
| | Action | File | | ||
| | ----------------------------------------------------------------------- | ------------------------------------------------------- | | ||
| | Remove `defaultItemHeight` prop + Virtuoso spread | `src/components/MessageList/VirtualizedMessageList.tsx` | | ||
| | Remove `head` prop + rendering logic (verify thread headers still work) | `src/components/MessageList/VirtualizedMessageList.tsx` | | ||
| | Remove `overscan` prop + Virtuoso prop | `src/components/MessageList/VirtualizedMessageList.tsx` | | ||
| | Remove `scrollSeekPlaceHolder` prop + Virtuoso config | `src/components/MessageList/VirtualizedMessageList.tsx` | | ||
|
|
||
| ### Batch 6: Misc Cleanup (items 28, 29) | ||
|
|
||
| **Risk: Medium** | ||
|
|
||
| | Action | File | | ||
| | ---------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | | ||
| | Remove string overload branch (`typeof dataOrName === 'string'`) | `src/components/Message/hooks/useActionHandler.ts` | | ||
| | Update `ActionHandlerReturnType` to only accept `FormData` | `src/components/Message/hooks/useActionHandler.ts` | | ||
| | Update tests if any use the string overload | `src/components/Message/hooks/__tests__/useActionHandler.test.tsx` | | ||
| | Remove `formatDate` prop from `MessageProps` and `MessageContextValue` (has `// todo: remove`) | `src/components/Message/types.ts`, `src/context/MessageContext.tsx` | | ||
| | Remove `formatDate` pass-through in Message component and i18n integration | `src/i18n/utils.ts`, `src/i18n/types.ts` | | ||
| | **Note:** `DateSeparator.formatDate` is a separate prop and should be kept | | | ||
|
|
||
| ### Batch 7: Legacy Formats (items 30, 31) β Needs Discussion | ||
|
|
||
| **Risk: High** β These are not formally `@deprecated` but are named "Legacy" and have newer replacements. Removal is more invasive. | ||
|
|
||
| | Item | Details | | ||
| | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | `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. | | ||
| | `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. | | ||
|
|
||
| **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. | ||
|
|
||
| ## Items to NOT Remove | ||
|
|
||
| | Item | Reason | | ||
| | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | ||
| | `hasMore`/`hasMoreNewer`/`loadMore`/`loadMoreNewer` on **MessageList** and **VirtualizedMessageList** | NOT deprecated β canonical API from ChannelStateContext/ChannelActionContext | | ||
| | `_componentName` params on context hooks | Backward-compatible call-site markers, no benefit to removing | | ||
|
|
||
| ## Verification (per batch) | ||
|
|
||
| 1. `yarn types` β No type errors from removed types/props | ||
| 2. `yarn test` β Full test suite passes | ||
| 3. `yarn build` β Build succeeds | ||
| 4. `yarn lint-fix` β No lint issues | ||
| 5. For Batch 5: manually verify thread rendering in the example app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably use
moveChannelUpwardsfunction.