chore: split composer API and reintroduce RichTextComposerAPI - #41286
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
WalkthroughThe composer APIs now share a new core factory for state, persistence, formatting, event dispatch, and common editor helpers. Plain-text and rich-text implementations retain their specialized text and selection operations while composing their public APIs from the shared core. ChangesComposer API consolidation
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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 |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## poc/real-time-composer #41286 +/- ##
==========================================================
+ Coverage 68.08% 68.14% +0.05%
==========================================================
Files 3976 3977 +1
Lines 155555 155547 -8
Branches 27991 27997 +6
==========================================================
+ Hits 105906 105991 +85
+ Misses 44913 44819 -94
- Partials 4736 4737 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
b59db10 to
f79f20b
Compare
6eda512 to
7021e91
Compare
f694f6a to
56249bf
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts (1)
24-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove newly introduced implementation comments.
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts#L24-L24: express or track the React tracker cleanup outside implementation comments.apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts#L205-L207: move the observer performance rationale to tests or PR documentation.apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts#L62-L62: remove the redundant HTML-storage explanation.As per coding guidelines, “Avoid code comments in the implementation.” <coding_guidelines>
🤖 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 `@apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts` at line 24, Remove the implementation comments from createComposerAPICore.ts at lines 24 and 205-207, and from createRichTextComposerAPI.ts at line 62; preserve the surrounding behavior and move any necessary rationale to tests or PR documentation instead.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.
Inline comments:
In `@apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts`:
- Line 89: Update the persistence lifecycle around persist, save, and release so
teardown handles any pending debounce before removing listeners or
clearing/reusing the input element. During release, synchronously flush the
pending save when the latest draft must be preserved, then cancel remaining
debounce state to prevent later execution.
In `@apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts`:
- Around line 56-70: Make draft persistence and restoration symmetric in
createComposerAPICore: align the save callback’s innerHTML serialization with
the initialization path that uses setText, either by persisting plain text or by
restoring sanitized HTML through a rich-text initializer. Update the relevant
save and initialValue handling without changing unrelated composer behavior.
- Around line 52-54: Update the composer API setup and release flow around the
input listener and core.release() so the registered handler is stored and
explicitly removed during release. Ensure recreating the API on the same editor
leaves only one active listener and does not retain stale parseOptions.
---
Nitpick comments:
In `@apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts`:
- Line 24: Remove the implementation comments from createComposerAPICore.ts at
lines 24 and 205-207, and from createRichTextComposerAPI.ts at line 62; preserve
the surrounding behavior and move any necessary rationale to tests or PR
documentation instead.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 4a270c76-50ed-4df9-a10e-4f9603eaf514
📒 Files selected for processing (3)
apps/meteor/app/ui-message/client/messageBox/createComposerAPI.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPICore.tsapps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: 📦 Build Packages
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.tsapps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
🧠 Learnings (3)
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.tsapps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.tsapps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.tsapps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.tsapps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
🔇 Additional comments (3)
apps/meteor/app/ui-message/client/messageBox/createComposerAPICore.ts (1)
1-23: LGTM!Also applies to: 25-88, 90-204, 208-218, 223-253
apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts (1)
3-3: LGTM!Also applies to: 15-58, 136-174
apps/meteor/app/ui-message/client/messageBox/createRichTextComposerAPI.ts (1)
6-50: LGTM!Also applies to: 74-188, 195-222
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
fd61b66
into
poc/real-time-composer
Proposed changes (including videos or screenshots)
Issue(s)
RTC-4
Steps to test or reproduce
Further comments
Summary by CodeRabbit