Skip to content

[WIKI-534] fix: save title input on closing#7366

Merged
sriramveeraghanta merged 2 commits intopreviewfrom
fix/title-input-on-close
Jul 9, 2025
Merged

[WIKI-534] fix: save title input on closing#7366
sriramveeraghanta merged 2 commits intopreviewfrom
fix/title-input-on-close

Conversation

@Palanikannan1437
Copy link
Member

@Palanikannan1437 Palanikannan1437 commented Jul 9, 2025

Description

Saving the title input on closing the peek overview

Summary by CodeRabbit

  • New Features
    • Improved tracking of unsaved changes when editing issue titles.
    • Automatically saves the latest title if there are unsaved changes when leaving the page or closing the editor.
  • Bug Fixes
    • Enhanced data consistency by ensuring title changes are not lost during navigation or unmounting.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 9, 2025

Walkthrough

The IssueTitleInput component now explicitly tracks unsaved changes to the issue title using React refs. It ensures that any unsaved title changes are saved when the component unmounts, maintaining data consistency. The component's public API remains unchanged.

Changes

File(s) Change Summary
apps/web/core/components/issues/title-input.tsx Added explicit tracking of unsaved title changes with refs; saves unsaved changes on unmount.

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
Loading

Possibly related PRs

Suggested labels

🐛bug, 🌐frontend, ready to merge

Poem

A bunny hops with nimble care,
Saving titles everywhere.
No unsaved words will slip away,
Even if you hop astray.
With every mount and every leave,
Your edits safe, you can believe!
🐇💾


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 63ade36 and 70d5416.

📒 Files selected for processing (1)
  • apps/web/core/components/issues/title-input.tsx (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/core/components/issues/title-input.tsx
⏰ 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)
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Palanikannan1437 Palanikannan1437 force-pushed the fix/title-input-on-close branch from f83fbc4 to 63ade36 Compare July 9, 2025 06:20
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ce700f and 63ade36.

📒 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 currentTitleRef in sync with the title state 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.tsx

The useDebounce hook clears its pending timer on unmount, and the hasUnsavedChanges flag is reset in each save’s finally block—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.

@Palanikannan1437 Palanikannan1437 changed the title fix: save title input on closing [WIKI-534] fix: save title input on closing Jul 9, 2025
@makeplane
Copy link

makeplane bot commented Jul 9, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@sriramveeraghanta sriramveeraghanta merged commit dadd76b into preview Jul 9, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the fix/title-input-on-close branch July 9, 2025 08:07
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* fix: save title input on closing

* fix: title input updatioin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants