Skip to content

fix: use client mandated composer queue#3222

Merged
oliverlaz merged 6 commits into
masterfrom
fix/use-client-mandated-composer-queue
Jun 17, 2026
Merged

fix: use client mandated composer queue#3222
oliverlaz merged 6 commits into
masterfrom
fix/use-client-mandated-composer-queue

Conversation

@isekovanic

@isekovanic isekovanic commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

🎯 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

    • The message composer now uses the shared client-side cache provided by the chat client, improving consistency across views and avoiding duplicate cache setup.
  • Chores

    • Bumped stream-chat to a newer patch version in the main project and example packages.
    • Updated package manager configuration to explicitly allow stream-chat.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▢️ Resume reviews
  • πŸ” Trigger review
πŸ“ Walkthrough

Walkthrough

useMessageComposerController now uses the client-provided queueCache from useChatContext instead of locally constructing it; repo examples and devDependencies bump stream-chat to ^9.45.6 and .yarnrc.yml preapproves stream-chat.

Changes

Message Composer Cache Sourcing

Layer / File(s) Summary
Client-provided queue cache integration
src/components/MessageComposer/hooks/useMessageComposerController.ts
Remove local FixedSizeQueueCache instantiation; derive queueCache from useChatContext().client.messageComposerCache. Update imports to drop FixedSizeQueueCache, and extend the useMemo dependency array to include the new queueCache source.

Dependency & Config Updates

Layer / File(s) Summary
Yarn preapproval
.yarnrc.yml
Add npmPreapprovedPackages: ["stream-chat"] section to Yarn configuration.
Example app dependency bumps
examples/tutorial/package.json, examples/vite/package.json
Bump stream-chat dependency from ^9.44.2 to ^9.45.6 in example projects.
DevDependency bump
package.json
Update devDependencies.stream-chat from ^9.44.2 to ^9.45.6.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A little queue hopped from local to known,
Now client keeps watch so I'm not alone.
Versions refreshed, the deps all sing,
Yarn nods yes, preapproved in spring.
A tiny refactorβ€”neat and clean-grown. 🌱

πŸš₯ Pre-merge checks | βœ… 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description references a mirror PR but lacks implementation details and leaves template sections unfilled, making it incomplete and vague. Expand the Implementation details section to explain what queueCache is, why it's now client-mandated, and impact of the change. Add UI Changes section or note if none apply.
βœ… Passed checks (4 passed)
Check name Status Explanation
Title check βœ… Passed The title clearly and specifically refers to the main change: using the client-mandated composer queue instead of a locally constructed one.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check βœ… Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check βœ… Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/use-client-mandated-composer-queue

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.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread src/components/MessageComposer/hooks/useMessageComposerController.ts Outdated
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

Size Change: -37 B (-0.01%)

Total Size: 657 kB

πŸ“¦ View Changed
Filename Size Change
dist/cjs/emojis.js 2.54 kB -2 B (-0.08%)
dist/cjs/index.js 255 kB -2 B (0%)
dist/cjs/useNotificationApi.js 49.8 kB -6 B (-0.01%)
dist/es/emojis.mjs 2.47 kB -1 B (-0.04%)
dist/es/index.mjs 252 kB -1 B (0%)
dist/es/useNotificationApi.mjs 48.5 kB -25 B (-0.05%)
ℹ️ View Unchanged
Filename Size
dist/cjs/audioProcessing.js 1.74 kB
dist/cjs/mp3-encoder.js 814 B
dist/cjs/ReactPlayerWrapper.js 545 B
dist/css/emoji-picker.css 178 B
dist/css/emoji-replacement.css 456 B
dist/css/index.css 39.7 kB
dist/es/audioProcessing.mjs 1.65 kB
dist/es/mp3-encoder.mjs 768 B
dist/es/ReactPlayerWrapper.mjs 485 B

compressed-size-action

Co-authored-by: Anton Arnautov <43254280+arnautov-anton@users.noreply.github.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/components/MessageComposer/hooks/useMessageComposerController.ts (1)

45-45: ⚠️ Potential issue | 🟠 Major | ⚑ Quick win

Use channel.cid instead of channel in hook dependencies.

This dependency array violates the SDK rule and can cause unnecessary useMemo invalidation when the channel object identity changes.

Suggested fix
-  }, [cachedParentMessage, channel, client, threadInstance]);
+  }, [cachedParentMessage, channel.cid, client, threadInstance]);

As per coding guidelines: β€œDo not include channel in dependency arrays; use channel.cid only (stable identifier), not channel.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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 9e7ba17 and ca53836.

πŸ“’ 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

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 83.97%. Comparing base (a7e9006) to head (af13a4d).

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.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@oliverlaz oliverlaz merged commit 57906bb into master Jun 17, 2026
13 checks passed
@oliverlaz oliverlaz deleted the fix/use-client-mandated-composer-queue branch June 17, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants