fix: pass missing BlockContext argument to renderTextObject in Sectio…#39494
fix: pass missing BlockContext argument to renderTextObject in Sectio…#39494SamarthShukla17 wants to merge 2 commits intoRocketChat:developfrom
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 |
🦋 Changeset detectedLatest commit: e784746 The changes in this PR will be included in the next version bump. This PR includes changesets to release 41 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (1)📚 Learning: 2025-11-17T15:07:13.273ZApplied to files:
🔇 Additional comments (2)
WalkthroughFixes a TypeScript compilation error in SectionBlock.tsx by converting the UiKit import from type-only to runtime import and passing the missing BlockContext argument to the renderTextObject function call. Includes a changeset entry documenting the fix. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). 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 |
There was a problem hiding this comment.
Pull request overview
This PR updates the Fuselage UI Kit SectionBlock rendering to explicitly pass a BlockContext when calling surfaceRenderer.renderTextObject, and adds a changeset to release the fix as a patch.
Changes:
- Update
SectionBlockto pass an explicitBlockContexttorenderTextObject. - Switch
@rocket.chat/ui-kitimport inSectionBlockfrom type-only to value import to accessBlockContextat runtime. - Add a patch changeset documenting the fix.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/fuselage-ui-kit/src/blocks/SectionBlock.tsx | Passes an explicit BlockContext to renderTextObject for section text rendering. |
| .changeset/soft-fans-hug.md | Declares a patch release note for the SectionBlock context argument change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| {text && ( | ||
| <Box is='span' fontScale='p2' color='default'> | ||
| {surfaceRenderer.renderTextObject(text, 0)} | ||
| {surfaceRenderer.renderTextObject(text, 0, UiKit.BlockContext.NONE)} | ||
| </Box> |
There was a problem hiding this comment.
SectionBlock is rendering the section's text with BlockContext.NONE. For a text object inside a section block, the correct semantic context is BlockContext.SECTION (this is how other renderers in the repo render section text), which keeps behavior consistent and avoids future context-specific rendering differences.
There was a problem hiding this comment.
Thanks for the suggestion! However, every other block in this codebase
(CalloutBlock.tsx, InputBlock.tsx, ImageBlock.tsx, ActionsBlock.tsx,
PreviewBlock.tsx, InfoCard.tsx, and even SectionBlock.Fields.tsx)
uses BlockContext.NONE for renderTextObject calls. Using BlockContext.NONE
keeps this consistent with the rest of the codebase.
Proposed changes (including videos or screenshots)
renderTextObjectinSectionBlock.tsxwas being called with 2 argumentsinstead of the required 3 after the refactor in #39268. This caused a
TypeScript build error on develop.
Changes:
UiKit.BlockContext.NONEas the third argument torenderTextObjectimport type * as UiKittoimport * as UiKitsinceBlockContextis a runtime const object, not just a type
Issue(s)
Closes #39493
Steps to test or reproduce
yarn dev@rocket.chat/fuselage-ui-kitcompiles with 0 errors(previously showed: error TS2554: Expected 3 arguments, but got 2)
Further comments
Every other call to
renderTextObjectin the codebase already passesUiKit.BlockContext.NONEas the third argument — seeButtonElement.tsx,CalloutBlock.tsx,InputBlock.tsxetc. This bringsSectionBlock.tsxin line with the rest.
Summary by CodeRabbit
Bug Fixes