[WIKI-637] fix: work item description version history#7725
[WIKI-637] fix: work item description version history#7725sriramveeraghanta merged 2 commits intopreviewfrom
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughUpdates description handling and editor mounting: root computes Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant Root as DescriptionVersionsRoot
participant Modal as DescriptionVersionsModal
participant Editor as RichTextEditor
User->>Root: open versions modal
Root->>Root: compute activeVersionDescription from activeVersionResponse
Root->>Modal: open(description = activeVersionDescription, id = activeVersionId)
alt activeVersionId && activeVersionDescription
Note right of Modal: Render editor with forced remount\nkey = activeVersionId
Modal->>Editor: mount(id = activeVersionId, initialValue = activeVersionDescription)
Editor-->>Modal: ready
else missing id or description
Note right of Modal: Render loader/placeholder instead of editor
Modal-->>User: show loader/placeholder
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/web/core/components/core/description-versions/root.tsx (1)
80-82: Disable nav buttons while index is unknown to avoid no-op clicks.When
versionsisn’t loaded,activeVersionIndexisundefined, but the buttons aren’t disabled. Minor UX nit—disable until the index is known.Apply this diff:
- isNextDisabled={activeVersionIndex === versionsCount - 1} + isNextDisabled={activeVersionIndex === undefined || activeVersionIndex === versionsCount - 1} isOpen={isModalOpen} - isPrevDisabled={activeVersionIndex === 0} + isPrevDisabled={activeVersionIndex === undefined || activeVersionIndex === 0}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/web/core/components/core/description-versions/root.tsx(2 hunks)
⏰ 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)
- GitHub Check: Build and lint web apps
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
apps/web/core/components/core/description-versions/root.tsx (2)
70-70: Prop wiring looks right.Passing the derived var keeps modal logic clean. Ensure the modal does not internally coerce
undefinedback to"<p></p>"before the fetch completes to avoid reintroducing the flicker.
51-53: Types and guard verified; changes approved
Props defineactiveVersionDescriptionasstring | undefined, and theRichTextEditormounts only whenactiveVersionDescriptionis truthy, preventing premature initialization.
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where work item description version history doesn't render initially in the modal but works correctly when re-opened. The issue was caused by passing an empty <p></p> tag while the API request was in progress, which prevented the editor from updating once the actual content was loaded.
- Improved the conditional check for API request completion to be more explicit
- Extracted the description logic into a separate variable for better readability
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
apps/web/core/components/core/description-versions/modal.tsx (3)
134-142: Solid fix; consider explicit undefined checks to avoid falsy edge cases.Truthiness can hide legitimate empty values later. Use explicit undefined checks for readiness.
- {activeVersionId && activeVersionDescription ? ( + {activeVersionId !== undefined && activeVersionDescription !== undefined ? (If
"), this prevents the loader from persisting indefinitely. Can you confirm root.tsx never setsdescription_htmlcould ever be an empty string (not "activeVersionDescriptionto ""?
167-179: Disable “Copy Markdown” until the editor is ready.Prevents a no-op click when the editor isn’t mounted yet.
Add a readiness flag near Line 61:
const isEditorReady = activeVersionId !== undefined && activeVersionDescription !== undefined;Then apply:
- <button + <button type="button" className={cn( "flex-shrink-0", getButtonStyling("neutral-primary", "sm"), "border-none grid place-items-center" )} onClick={handleCopyMarkdown} + disabled={!isEditorReady} + aria-disabled={!isEditorReady} >
”) if data hasn’t loaded; gate the action.
184-195: Avoid restoring a placeholder (“Restoring before data arrives could overwrite content with an empty paragraph.
- <Button + <Button variant="primary" size="sm" - onClick={() => { - handleRestore(activeVersionDescription ?? "<p></p>"); - handleClose(); - }} + disabled={activeVersionDescription === undefined} + onClick={() => { + if (activeVersionDescription !== undefined) { + handleRestore(activeVersionDescription); + handleClose(); + } + }} >If
isRestoreDisabledis already true while loading, this becomes a no-op; otherwise the disable guard above is needed. Can you confirm current loading states keep restore disabled?
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/web/core/components/core/description-versions/modal.tsx(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/web/core/components/core/description-versions/modal.tsx (1)
apps/space/core/components/editor/rich-text-editor.tsx (1)
RichTextEditor(30-66)
⏰ 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)
- GitHub Check: Build and lint web apps
- GitHub Check: Analyze (javascript)
Description
This PR fixes the bug where description version history for work items doesn't render when the modal is opened initially, but renders fine when it is re-opened.
Cause of bug- An empty
ptag was being passed until the API request was completed for version history details which initialized the editor with the emptyptag and didn't update later when the call was successful.Fix- The check for API request completion is now stricter.
Type of Change
Summary by CodeRabbit