feat: add rich text description to modules - #9502
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughModule descriptions now support rich-text HTML editing, legacy text migration, workspace mentions, and editor asset operations across module forms and the analytics sidebar. New module description asset types and backend asset routing are included. ChangesModule rich-text description editing
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ModuleForm
participant ModuleDescriptionEditor
participant RichTextEditor
participant WorkspaceService
participant ModuleUpdate
ModuleForm->>ModuleDescriptionEditor: provide description_html initial value
ModuleDescriptionEditor->>RichTextEditor: bind description_html
RichTextEditor->>WorkspaceService: searchEntity(project_id)
RichTextEditor-->>ModuleDescriptionEditor: edited HTML
ModuleDescriptionEditor-->>ModuleForm: update form field
ModuleForm->>ModuleUpdate: submit description_html
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ 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 |
|
Closes #9428 |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (2)
apps/web/core/components/modules/analytics-sidebar/root.tsx (2)
253-253: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winMemoize
getModuleDescriptionInitialValue(moduleDetails)for consistency and to avoid recomputation on unrelated re-renders.Computed inline here on every observer re-render, unlike the sibling usage in
form.tsxwhich wraps the same utility inuseMemo. Since this component re-renders on any relevant mobx observable change, this recomputes the HTML emptiness check/conversion each time even when the description itself hasn't changed.♻️ Proposed fix
+ const descriptionInitialValue = useMemo(() => getModuleDescriptionInitialValue(moduleDetails), [moduleDetails]); ... - initialValue={getModuleDescriptionInitialValue(moduleDetails)} + initialValue={descriptionInitialValue}(Add
useMemoto the existingreactimport.)🤖 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/web/core/components/modules/analytics-sidebar/root.tsx` at line 253, Memoize the value passed to `initialValue` in the component containing this prop by adding `useMemo` to the React imports and wrapping `getModuleDescriptionInitialValue(moduleDetails)` with dependencies limited to the relevant module description input, matching the existing pattern in `form.tsx`.
222-224: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid
anyfor the status select'sonChangevalue.
selectedStatusflows directly intosubmitChanges({ status: selectedStatus }), which targetsIModule["status"](TModuleStatus). Typing it explicitly avoids losing compile-time safety on this value.As per coding guidelines, "TypeScript strict mode enabled; all files must be typed."
♻️ Proposed fix
- onChange={(selectedStatus: any) => { + onChange={(selectedStatus: TModuleStatus) => { submitChanges({ status: selectedStatus }); }}(Add
TModuleStatusto the@plane/typesimport at Line 26.)🤖 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/web/core/components/modules/analytics-sidebar/root.tsx` around lines 222 - 224, Replace the any annotation on selectedStatus in the analytics sidebar status select onChange handler with TModuleStatus, importing TModuleStatus from `@plane/types`, so submitChanges receives the module status type safely.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/api/plane/db/models/asset.py`:
- Line 47: Update the asset_url resolution logic in the asset model to include
MODULE_DESCRIPTION alongside the existing description entity types, ensuring
uploaded and duplicated module-editor assets resolve to their URLs instead of
returning None.
In `@apps/web/core/components/modules/description-editor.tsx`:
- Around line 68-98: Update the uploadFile and duplicateFile error handlers to
log the caught errors with the component’s established logging mechanism before
rethrowing. Preserve the user-facing error messages, and change duplicateFile to
capture the original error and include it as the cause, matching uploadFile’s
behavior.
- Around line 46-99: Add a module-specific React key to the RichTextEditor
rendered by ModuleDescriptionEditor, using moduleId so the uncontrolled editor
remounts when the modal switches modules. Keep the existing static id and all
other editor props unchanged.
---
Nitpick comments:
In `@apps/web/core/components/modules/analytics-sidebar/root.tsx`:
- Line 253: Memoize the value passed to `initialValue` in the component
containing this prop by adding `useMemo` to the React imports and wrapping
`getModuleDescriptionInitialValue(moduleDetails)` with dependencies limited to
the relevant module description input, matching the existing pattern in
`form.tsx`.
- Around line 222-224: Replace the any annotation on selectedStatus in the
analytics sidebar status select onChange handler with TModuleStatus, importing
TModuleStatus from `@plane/types`, so submitChanges receives the module status
type safely.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f3d12995-786b-4cb4-b044-3c2512bfe4f4
📒 Files selected for processing (6)
apps/api/plane/db/models/asset.pyapps/web/core/components/modules/analytics-sidebar/root.tsxapps/web/core/components/modules/description-editor.tsxapps/web/core/components/modules/form.tsxpackages/types/src/enums.tspackages/utils/src/module.ts
aaab462 to
335f675
Compare
Description
Type of Change
Screenshots and Media (if applicable)
Test Scenarios
References
Summary by CodeRabbit