fix(app): scroll issues
Some checks failed
beta / sync (push) Has been cancelled
docs-update / update-docs (push) Has been cancelled
deploy / deploy (push) Has been cancelled
generate / generate (push) Has been cancelled
nix-eval / nix-eval (push) Has been cancelled
publish / version (push) Has been cancelled
test / unit (linux) (push) Has been cancelled
test / unit (windows) (push) Has been cancelled
typecheck / typecheck (push) Has been cancelled
publish / build-cli (push) Has been cancelled
publish / build-tauri (map[host:blacksmith-4vcpu-ubuntu-2404 target:x86_64-unknown-linux-gnu]) (push) Has been cancelled
publish / build-tauri (map[host:blacksmith-4vcpu-windows-2025 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
publish / build-tauri (map[host:blacksmith-8vcpu-ubuntu-2404-arm target:aarch64-unknown-linux-gnu]) (push) Has been cancelled
publish / build-tauri (map[host:macos-latest target:aarch64-apple-darwin]) (push) Has been cancelled
publish / build-tauri (map[host:macos-latest target:x86_64-apple-darwin]) (push) Has been cancelled
publish / publish (push) Has been cancelled
test / e2e (linux) (push) Has been cancelled
test / e2e (windows) (push) Has been cancelled
test / test (linux) (push) Has been cancelled
daily-pr-recap / pr-recap (push) Has been cancelled
daily-issues-recap / daily-recap (push) Has been cancelled
stats / stats (push) Has been cancelled
close-stale-prs / close-stale-prs (push) Failing after 3s
stale-issues / stale (push) Successful in 3s
compliance-close / close-non-compliant (push) Successful in 2s
Some checks failed
beta / sync (push) Has been cancelled
docs-update / update-docs (push) Has been cancelled
deploy / deploy (push) Has been cancelled
generate / generate (push) Has been cancelled
nix-eval / nix-eval (push) Has been cancelled
publish / version (push) Has been cancelled
test / unit (linux) (push) Has been cancelled
test / unit (windows) (push) Has been cancelled
typecheck / typecheck (push) Has been cancelled
publish / build-cli (push) Has been cancelled
publish / build-tauri (map[host:blacksmith-4vcpu-ubuntu-2404 target:x86_64-unknown-linux-gnu]) (push) Has been cancelled
publish / build-tauri (map[host:blacksmith-4vcpu-windows-2025 target:x86_64-pc-windows-msvc]) (push) Has been cancelled
publish / build-tauri (map[host:blacksmith-8vcpu-ubuntu-2404-arm target:aarch64-unknown-linux-gnu]) (push) Has been cancelled
publish / build-tauri (map[host:macos-latest target:aarch64-apple-darwin]) (push) Has been cancelled
publish / build-tauri (map[host:macos-latest target:x86_64-apple-darwin]) (push) Has been cancelled
publish / publish (push) Has been cancelled
test / e2e (linux) (push) Has been cancelled
test / e2e (windows) (push) Has been cancelled
test / test (linux) (push) Has been cancelled
daily-pr-recap / pr-recap (push) Has been cancelled
daily-issues-recap / daily-recap (push) Has been cancelled
stats / stats (push) Has been cancelled
close-stale-prs / close-stale-prs (push) Failing after 3s
stale-issues / stale (push) Successful in 3s
compliance-close / close-non-compliant (push) Successful in 2s
This commit is contained in:
@@ -49,6 +49,7 @@ export function SessionReviewTab(props: SessionReviewTabProps) {
|
||||
let scroll: HTMLDivElement | undefined
|
||||
let restoreFrame: number | undefined
|
||||
let userInteracted = false
|
||||
let restored: { x: number; y: number } | undefined
|
||||
|
||||
const sdk = useSDK()
|
||||
const layout = useLayout()
|
||||
@@ -65,6 +66,11 @@ export function SessionReviewTab(props: SessionReviewTabProps) {
|
||||
|
||||
const handleInteraction = () => {
|
||||
userInteracted = true
|
||||
|
||||
if (restoreFrame !== undefined) {
|
||||
cancelAnimationFrame(restoreFrame)
|
||||
restoreFrame = undefined
|
||||
}
|
||||
}
|
||||
|
||||
const doRestore = () => {
|
||||
@@ -82,8 +88,11 @@ export function SessionReviewTab(props: SessionReviewTabProps) {
|
||||
const targetY = Math.min(s.y, maxY)
|
||||
const targetX = Math.min(s.x, maxX)
|
||||
|
||||
if (el.scrollTop === targetY && el.scrollLeft === targetX) return
|
||||
|
||||
if (el.scrollTop !== targetY) el.scrollTop = targetY
|
||||
if (el.scrollLeft !== targetX) el.scrollLeft = targetX
|
||||
restored = { x: el.scrollLeft, y: el.scrollTop }
|
||||
}
|
||||
|
||||
const queueRestore = () => {
|
||||
@@ -92,9 +101,16 @@ export function SessionReviewTab(props: SessionReviewTabProps) {
|
||||
}
|
||||
|
||||
const handleScroll = (event: Event & { currentTarget: HTMLDivElement }) => {
|
||||
if (!layout.ready() || !userInteracted) return
|
||||
|
||||
const el = event.currentTarget
|
||||
const prev = restored
|
||||
if (prev && el.scrollTop === prev.y && el.scrollLeft === prev.x) {
|
||||
restored = undefined
|
||||
return
|
||||
}
|
||||
|
||||
restored = undefined
|
||||
handleInteraction()
|
||||
if (!layout.ready()) return
|
||||
if (el.clientHeight === 0 || el.clientWidth === 0) return
|
||||
|
||||
props.view().setScroll("review", {
|
||||
@@ -133,10 +149,11 @@ export function SessionReviewTab(props: SessionReviewTabProps) {
|
||||
onCleanup(() => {
|
||||
if (restoreFrame !== undefined) cancelAnimationFrame(restoreFrame)
|
||||
if (scroll) {
|
||||
scroll.removeEventListener("wheel", handleInteraction)
|
||||
scroll.removeEventListener("pointerdown", handleInteraction)
|
||||
scroll.removeEventListener("touchstart", handleInteraction)
|
||||
scroll.removeEventListener("keydown", handleInteraction)
|
||||
scroll.removeEventListener("wheel", handleInteraction, { capture: true })
|
||||
scroll.removeEventListener("mousewheel", handleInteraction, { capture: true })
|
||||
scroll.removeEventListener("pointerdown", handleInteraction, { capture: true })
|
||||
scroll.removeEventListener("touchstart", handleInteraction, { capture: true })
|
||||
scroll.removeEventListener("keydown", handleInteraction, { capture: true })
|
||||
}
|
||||
})
|
||||
|
||||
@@ -147,6 +164,7 @@ export function SessionReviewTab(props: SessionReviewTabProps) {
|
||||
scrollRef={(el) => {
|
||||
scroll = el
|
||||
el.addEventListener("wheel", handleInteraction, { passive: true, capture: true })
|
||||
el.addEventListener("mousewheel", handleInteraction, { passive: true, capture: true })
|
||||
el.addEventListener("pointerdown", handleInteraction, { passive: true, capture: true })
|
||||
el.addEventListener("touchstart", handleInteraction, { passive: true, capture: true })
|
||||
el.addEventListener("keydown", handleInteraction, { passive: true, capture: true })
|
||||
|
||||
Reference in New Issue
Block a user