Repository navigation
fix(desktop): preserve session reading positions across pane eviction - #1665
Merged
Merged
Conversation
Keep renderer-lifetime reading bookmarks separate from the bounded pane cache so returning to a conversation restores its message and viewport offset even after the pane unmounts or its history page is revalidated. Let user input, search and new turns supersede restoration without changing persistence or the three-pane retention limit. Cover the lifecycle and stale reads with isolated renderer and runtime regressions.
Contributor
|
审读了 diff(+800/-54,20 文件)并跟了 CI 失败,方向对、测试面也厚,但当前 JS job 是红的,且失败原因就是本 PR 自身——合并前需要处理。 CI 失败定位(阻塞项)JS job 失败在 4 个既有契约测试上,它们不在本 PR 的 diff 里,但断言的正则匹配的是本 PR 重构掉的源码形状:
这几条是仓库惯用的源码契约断言(正则匹配实现形状)。既然本 PR 重排了 复核要点(无阻塞,供参考)
修好 CI 后我可以再看一遍。 |
Keep the disclosure and window contracts aligned with the new renderer-lifetime reading bookmark hook. The old source assertions failed against the intended refactor even though the targeted behavior and runtime tests pass.
Contributor
|
CI 已绿(JS job 6m49s 全过),阻塞解除。复核了 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix conversation reading positions being lost when switching sessions, including returns after the original pane has been evicted.
Reproduction and regression coverage
On the old code, an isolated React/Chromium test read at scrollTop 650, switched away and back, and returned at approximately 5556 (the stale bottom). Restoring the visible scroll sample fixed the warm return, but A → B → C → D → E → A still lost its position after A actually unmounted. The added regressions now cover both paths, expanded-content restoration, input cancellation, cold/pinned initialization, and new-turn follow.
The production SessionPane/store/API fixture mocks only the preload IPC boundary. It verifies restoration when revalidation returns a latest page that excludes the old anchor, no search highlight, unchanged live input, the three-pane bound, and return-to-latest. Runtime tests cover cancellation, search priority, session changes/eviction/new turns, missing anchors, IO errors and selection revalidation.
Validation
Task candidate:
9c8868c8cc84bc1b515cc146992a2f5e3aa62c7cBase main:
4f6890ecd4fd75683168333d433d93720fe9a215Environment: Windows; Node 24.19.0; pnpm 12.8.1; isolated Electron fixtures (no running Desktop, real Host or provider).
Passed on this candidate:
pnpm check:pr-basepnpm --filter @pi-desktop/desktop typecheckpnpm --filter @pi-desktop/desktop buildpnpm lintnode scripts/e2e-transcript-reading-position.mjsnode scripts/e2e-transcript-minimap-jump.mjsnode scripts/e2e-transcript-disclosure-anchor.mjsgit diff --checkLimitations: the full Desktop suite was attempted on the earlier
a20a9ca99base but exceeded 600 seconds and reported failures outside the changed surfaces (including settings/service, release-script and other tests). It is not claimed passing. One plugin-block failure passed 3/3 when rerun alone. No live user-instance or paid-provider checks were performed. This PR does not change those unrelated surfaces.