Skip to content

Draft restore overwrites live textarea input on Blazor re-render #571

@PureWeen

Description

@PureWeen

Problem

When Blazor re-renders (triggered by OnStateChanged), the draft restore system (restoreDraftsAndFocus) can overwrite whatever the user is currently typing with a stale draft from draftBySession.

Steps to reproduce

  1. Send a message (e.g., /prompt use PR Review -- 559) in a session
  2. The message is sent and the textarea clears
  3. Type a new message
  4. A Blazor re-render fires (from any state change)
  5. The textarea is overwritten with the OLD message (/prompt use PR Review -- 559)

Root cause

draftBySession retains the old draft text. The JS-side __liveDrafts mechanism captures live input and merges it before restore, but there's a race window: if the render happens between send (textarea cleared) and the next input event, the stale draft wins.

Relevant code

  • PolyPilot/wwwroot/index.html:687-787restoreDraftsAndFocus
  • PolyPilot/Components/Pages/Dashboard.razor:1167-1175,1209-1231 — draft save/restore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions