Skip to content

Conversation

@uinstinct
Copy link
Contributor

@uinstinct uinstinct commented Jan 23, 2026

Description

Save the unsubmitted input text into local storage so that it persists between reloads and page changes.

resolves CON-5281

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

before.mp4
after.mp4

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Continue Tasks: ▶️ 2 queued — View all


Summary by cubic

Persist unsubmitted drafts for both the main input and per-message edits in local storage so text and position survive reloads and navigation. Drafts auto-load per chat/message, restore scroll and focus, and clear on submit or when empty. Resolves CON-5281.

  • New Features

    • Save main input as JSON under inputDraft_; save per-message edit under editingDraft_ with content, messageId, and scrollTop.
    • Load saved drafts into the main input and matching message editor; restore scroll and focus when returning.
    • Clear the relevant draft after submission or when content becomes empty.
    • Added localStorage types for inputDraft_ and editingDraft_.
  • Refactors

    • Removed the clearContent effect in TipTapEditor to prevent wiping drafts on mount.

Written for commit d090ce5. Summary will update on new commits.

@uinstinct uinstinct requested a review from a team as a code owner January 23, 2026 05:46
@uinstinct uinstinct requested review from sestinj and removed request for a team January 23, 2026 05:46
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Jan 23, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Copy link
Collaborator

@RomneyDa RomneyDa left a comment

Choose a reason for hiding this comment

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

@uinstinct it looks like this only works for the main input. I think it's an improvement but can we think of a simple way to have this work across conversations and in any tip tap editor when going to settings and back?

  1. On closing/reopening vs code it's okay to lose drafts in any editor but would be nice if main editor was saved (already works on this branch) and great if all were saved (in a way that doesn't leak local storage etc memory)
  2. On going to settings and back any editor's content is preserved, as well as the scroll position of the chat history in case I was editing message number 2 in a 5 message sequence

If too many tradeoffs we can merge this but let's brainstorm on full solution first. There might be a simple solution where we don't unmount the component at all when switching to settings (router level fix).

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Feb 4, 2026
@uinstinct
Copy link
Contributor Author

  1. On closing/reopening vs code it's okay to lose drafts in any editor but would be nice if main editor was saved (already works on this branch) and great if all were saved (in a way that doesn't leak local storage etc memory)

It currently saves all - there would not be any memory leakage, as far as I think, because there can only be 2 drafts be saved: inputDraft_chat or inputDraft_edit which get cleared during submission

  1. On going to settings and back any editor's content is preserved, as well as the scroll position of the chat history in case I was editing message number 2 in a 5 message sequence

I did a simple implementation for this to save the editing draft and scroll back to chat history position.

feat.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants