Skip to content

fix: don't insert stale recorded action after user edits the file - #807

Open
Ashraf Ali (ashrafiucse) wants to merge 1 commit into
microsoft:mainfrom
ashrafiucse:fix-42218
Open

fix: don't insert stale recorded action after user edits the file#807
Ashraf Ali (ashrafiucse) wants to merge 1 commit into
microsoft:mainfrom
ashrafiucse:fix-42218

Conversation

@ashrafiucse

@ashrafiucse Ashraf Ali (ashrafiucse) commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • guard the sourceChanged re-render path: only update the editor while the selection still spans the exact text the extension previously inserted; when the user edited the file during recording, their edits are left alone instead of re-inserting the re-rendered action at their cursor
  • legitimate re-renders (dialog/assertion signals, merged fills) still update the editor while the recorded line is untouched

Fixes microsoft/playwright#42218

The cross-session variant (stale actions from a previous recording session) is fixed core-side: microsoft/playwright#42458

Related: #808 keeps the browser open after stopping a debug session, extending the record-after-debug workflow (microsoft/playwright#37822).

When the recorder re-renders the last action (e.g. a dialog or assertion
signal attached to it) while the user has edited the file during
recording, the selection no longer spans the previously inserted text,
so the old action was re-inserted at the user's cursor. Only update the
editor on such re-renders while the selection still spans the text we
had inserted.

Fixes: microsoft/playwright#42218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Record at cursor inserts stale/previous action after editing test while recording (browser focus loss)

1 participant