You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
view: apply edits to the latest source instead of whole-file snapshots #2067
This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.
Found in the review of #2057, which adds the experimental view. It does not block that PR; #2059 fixed the findings that did. Paths refer to #2059's head.
Problem
An edit from the sheet is the whole text of the file, built from host.source() when the edit is committed (web/view/src/main.ts). The host sets that text when the edit's turn comes (GitHubHost.edit in web/view/src/githubHost.ts).
If edits B and C are both committed while an evaluation runs, C is built from the text before B, so C erases B, after B was reported as applied.
This cannot happen today. Once the engine is loaded, evaluateView only awaits resolved promises and calls Wasm synchronously, so no input event runs between an edit's start and end. It will happen as soon as evaluation is really asynchronous, for example in a worker.
Related: #2059's ModelCache marks the models an edit did not re-project as stale, and re-projects them before use. Models are not tied to a source revision, so a late result cannot be recognised in general.
Proposed fix
Represent an edit as a range and its replacement (or a function of the latest source), and let the host apply it to its latest source on the edit's turn.
Give sources a revision, and record the revision each model was projected from.
Activity
View: edit pipeline (#2090 lane C) (#2109)