[diffs/edit] fix newline inserts without virtualizer - #1066
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 748809bcd5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const dirtyLines = tokenizer.tokenize( | ||
| change, | ||
| renderRange, | ||
| !this.#isDiff && fileInstance.getEditorViewport !== undefined |
There was a problem hiding this comment.
Don’t use the viewport hook as a row-realignment signal
This predicate treats any non-diff component that defines getEditorViewport as a host that will realign shifted rows, but that hook is also valid on a plain File just to bound editor focus/scrolling (see packages/diffs/test/editorPublicApi.test.ts:125-130). In that setup, inserting a newline after cached grammar states takes the shifted-state fast path again, so tokenize() can settle after only the split lines while File.applyDocumentChange() does not rerender/realign the existing DOM rows; the following row can still be left missing or stale, which is the same failure this patch is trying to avoid. Use a capability tied to virtualization/row realignment rather than the viewport callback.
Useful? React with 👍 / 👎.
this bug was introduced by #1057
Screen.Recording.2026-08-08.at.22.34.22.mov