fix: use client mandated composer queue#3222
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
π WalkthroughWalkthroughuseMessageComposerController now uses the client-provided queueCache from useChatContext instead of locally constructing it; repo examples and devDependencies bump ChangesMessage Composer Cache Sourcing
Dependency & Config Updates
Estimated code review effortπ― 2 (Simple) | β±οΈ ~12 minutes Poem
π₯ Pre-merge checks | β 4 | β 1β Failed checks (1 inconclusive)
β Passed checks (4 passed)
βοΈ Tip: You can configure your own custom pre-merge checks in the settings. β¨ Finishing Touchesπ§ͺ Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Size Change: -37 B (-0.01%) Total Size: 657 kB π¦ View Changed
βΉοΈ View Unchanged
|
Co-authored-by: Anton Arnautov <43254280+arnautov-anton@users.noreply.github.com>
There was a problem hiding this comment.
β»οΈ Duplicate comments (1)
src/components/MessageComposer/hooks/useMessageComposerController.ts (1)
45-45:β οΈ Potential issue | π Major | β‘ Quick winUse
channel.cidinstead ofchannelin hook dependencies.This dependency array violates the SDK rule and can cause unnecessary
useMemoinvalidation when the channel object identity changes.Suggested fix
- }, [cachedParentMessage, channel, client, threadInstance]); + }, [cachedParentMessage, channel.cid, client, threadInstance]);As per coding guidelines: βDo not include
channelin dependency arrays; usechannel.cidonly (stable identifier), notchannel.state.βπ€ Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/components/MessageComposer/hooks/useMessageComposerController.ts` at line 45, In the useMessageComposerController hook, the dependency array includes the `channel` object directly, which violates SDK rules and causes unnecessary useMemo invalidation when the channel object identity changes. Replace `channel` with `channel.cid` in the dependency array (the useMemo call at line 45) since channel.cid is a stable identifier that remains consistent across re-renders and object identity changes.Source: Coding guidelines
π€ Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@src/components/MessageComposer/hooks/useMessageComposerController.ts`:
- Line 45: In the useMessageComposerController hook, the dependency array
includes the `channel` object directly, which violates SDK rules and causes
unnecessary useMemo invalidation when the channel object identity changes.
Replace `channel` with `channel.cid` in the dependency array (the useMemo call
at line 45) since channel.cid is a stable identifier that remains consistent
across re-renders and object identity changes.
βΉοΈ Review info
βοΈ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: edd5e177-d834-4995-9336-e44d9e3510c2
π Files selected for processing (1)
src/components/MessageComposer/hooks/useMessageComposerController.ts
stream-chat 9.45 prepends the built-in `@channel` and `@here` special mentions to the autocomplete suggestion list. Update the two mention suggestion tests accordingly: expect the channel members plus the two built-in mentions, and select the user mention explicitly instead of relying on it being the first item.
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3222 +/- ##
==========================================
+ Coverage 83.95% 83.97% +0.02%
==========================================
Files 439 439
Lines 13224 13224
Branches 4295 4295
==========================================
+ Hits 11102 11105 +3
+ Misses 2122 2119 -3 β View full report in Codecov by Harness. π New features to boost your workflow:
|
π― Goal
A mirror of this PR from the React Native SDK.
π Implementation details
Provide a description of the implementation
π¨ UI Changes
Add relevant screenshots
Summary by CodeRabbit
Refactor
Chores
stream-chatto a newer patch version in the main project and example packages.stream-chat.