[WIKI-510] feat: enhance issue description input with unsaved changes tracking#7357
[WIKI-510] feat: enhance issue description input with unsaved changes tracking#7357
Conversation
|
""" WalkthroughThe update enhances the issue description input component by introducing explicit tracking of unsaved changes using a Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant DescriptionInput
participant SaveFunction
User->>DescriptionInput: Edit description
DescriptionInput->>DescriptionInput: Set hasUnsavedChanges = true
DescriptionInput->>SaveFunction: Debounced save (after delay)
SaveFunction-->>DescriptionInput: Save complete
DescriptionInput->>DescriptionInput: Set hasUnsavedChanges = false
Note over DescriptionInput: On component unmount
DescriptionInput->>SaveFunction: Cancel pending debounced save
alt hasUnsavedChanges == true
DescriptionInput->>SaveFunction: Synchronous save
SaveFunction-->>DescriptionInput: Save complete
DescriptionInput->>DescriptionInput: Set hasUnsavedChanges = false
end
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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). (1)
✨ Finishing Touches
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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/web/core/components/issues/description-input.tsx (1)
147-147: Flag setting logic may be overly aggressive.The unsaved changes flag is set on every onChange event, even if the content hasn't actually changed from the initial value. This could trigger unnecessary saves.
Consider checking if the content has actually changed before setting the flag:
onChange={(_description: object, description_html: string) => { setIsSubmitting("submitting"); onChange(description_html); - hasUnsavedChanges.current = true; + // Only set flag if content has actually changed + if (description_html !== initialValue) { + hasUnsavedChanges.current = true; + } debouncedFormSave(); }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/core/components/issues/description-input.tsx(4 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: Analyze (javascript)
- GitHub Check: Analyze (python)
🔇 Additional comments (4)
apps/web/core/components/issues/description-input.tsx (4)
3-3: LGTM: Import addition is correct.The
useRefimport is properly added for the new unsaved changes tracking functionality.
56-57: LGTM: Unsaved changes tracking approach is sound.Using
useRefto track unsaved changes is appropriate since it persists across re-renders without causing re-renders itself.
92-93: LGTM: Proper flag reset on form reset.Correctly resets the unsaved changes flag when the form is reset due to changes in initial value or issue ID.
101-104: LGTM: Proper flag reset after successful save.The unsaved changes flag is correctly reset after the debounced save completes in the
finallyblock.
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
Description
We now save the description just before closing the issue description modal
Summary by CodeRabbit
Bug Fixes
New Features