[WIKI-534] fix: save title input on closing#7366
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant IssueTitleInput
participant Backend
User->>IssueTitleInput: Edit title
IssueTitleInput->>IssueTitleInput: Set hasUnsavedChanges = true
User->>IssueTitleInput: Blur or debounce triggers save
IssueTitleInput->>Backend: Save title
Backend-->>IssueTitleInput: Save complete
IssueTitleInput->>IssueTitleInput: Set hasUnsavedChanges = false
Note over IssueTitleInput: On unmount, if hasUnsavedChanges, save title
IssueTitleInput->>Backend: Save latest title (if unsaved)
Backend-->>IssueTitleInput: Save complete
Possibly related PRs
Suggested labels
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 (
|
f83fbc4 to
63ade36
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
apps/web/core/components/issues/title-input.tsx(5 hunks)
🧰 Additional context used
🧠 Learnings (1)
apps/web/core/components/issues/title-input.tsx (1)
Learnt from: janreges
PR: makeplane/plane#6743
File: packages/i18n/src/store/index.ts:160-161
Timestamp: 2025-03-11T19:42:41.769Z
Learning: In the Plane project, the file 'packages/i18n/src/store/index.ts' already includes support for Polish language translations with the case "pl".
⏰ 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)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/web/core/components/issues/title-input.tsx (5)
3-3: Good approach using refs for tracking unsaved changes!Using refs to track unsaved changes and the current title value is the correct approach here, as it avoids unnecessary re-renders while ensuring the cleanup function has access to the latest state.
Also applies to: 45-48
61-65: Good synchronization of the title ref!Keeping
currentTitleRefin sync with thetitlestate ensures the cleanup function always has access to the latest value.
72-72: Correct handling of unsaved changes flag after save.The flag is properly reset after successful backend updates, preventing duplicate saves on unmount.
Also applies to: 81-81
139-139: Correctly tracking user modifications.Setting the unsaved changes flag when the user modifies the title ensures changes are saved on unmount.
116-134: No duplicate save race detected in title-input.tsxThe
useDebouncehook clears its pending timer on unmount, and thehasUnsavedChangesflag is reset in each save’sfinallyblock—so at most one save will ever run:
- If the debounce window elapses before unmount, it performs the update and clears
hasUnsavedChanges; the unmount handler then skips.- If unmount happens before the debounce fires, the debounce cleanup prevents its update, and the unmount handler runs exactly once.
No additional guard or diff is needed here.
Likely an incorrect or invalid review comment.
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
* fix: save title input on closing * fix: title input updatioin
Description
Saving the title input on closing the peek overview
Summary by CodeRabbit