Skip to content

[WIKI-510] feat: enhance issue description input with unsaved changes tracking#7357

Merged
pushya22 merged 2 commits intopreviewfrom
fix/save-on-close-description
Jul 8, 2025
Merged

[WIKI-510] feat: enhance issue description input with unsaved changes tracking#7357
pushya22 merged 2 commits intopreviewfrom
fix/save-on-close-description

Conversation

@Palanikannan1437
Copy link
Member

@Palanikannan1437 Palanikannan1437 commented Jul 8, 2025

Description

We now save the description just before closing the issue description modal

Summary by CodeRabbit

  • Bug Fixes

    • Improved reliability of saving issue descriptions by ensuring no unsaved changes are lost when navigating away or closing the form.
  • New Features

    • Issue description form now automatically saves unsaved changes before closing or switching issues, reducing the risk of data loss.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 8, 2025

"""

Walkthrough

The update enhances the issue description input component by introducing explicit tracking of unsaved changes using a useRef flag. It ensures that any unsaved changes are saved before the component unmounts by canceling pending debounced saves and performing a final synchronous save if necessary. No public API signatures were changed.

Changes

File(s) Change Summary
apps/web/core/components/issues/description-input.tsx Added hasUnsavedChanges ref to track unsaved edits, updated debounced save logic, and ensured final save on unmount.

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
Loading

Poem

A bunny taps the keys with care,
Ensuring changes linger not in air.
With flags and saves both swift and neat,
No edits lost, the cycle's complete.
On unmount’s hop, all data’s caught—
A tidy warren, nothing forgot! 🐇✨
"""


📜 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 90843a4 and e7c09eb.

📒 Files selected for processing (1)
  • apps/web/core/components/issues/description-input.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/core/components/issues/description-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.

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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between ab79a5d and 90843a4.

📒 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 useRef import is properly added for the new unsaved changes tracking functionality.


56-57: LGTM: Unsaved changes tracking approach is sound.

Using useRef to 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 finally block.

@Palanikannan1437 Palanikannan1437 changed the title feat: enhance issue description input with unsaved changes tracking [WIKI-510] feat: enhance issue description input with unsaved changes tracking Jul 8, 2025
@makeplane
Copy link

makeplane bot commented Jul 8, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

@pushya22 pushya22 merged commit 13ab062 into preview Jul 8, 2025
5 of 6 checks passed
@pushya22 pushya22 deleted the fix/save-on-close-description branch July 8, 2025 09:28
@pushya22 pushya22 linked an issue Jul 8, 2025 that may be closed by this pull request
1 task
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.

[bug]: Work item title modifications not saved if sidebar is closed directly

3 participants