fix(desktop): scope saved scroll by gateway

This commit is contained in:
Victor Nogueira
2026-08-27 16:52:37 +08:00
committed by Teknium
parent 0237fcc295
commit 52ce7b23d2
+8 -2
View File
@@ -1,5 +1,6 @@
import { atom, type WritableAtom } from 'nanostores'
import { activeConnectionScopeSuffix } from '@/lib/connection-scoped'
import { readKey, writeKey } from '@/lib/storage'
import { $activeProfile, normalizeProfileKey } from '@/store/profile'
@@ -153,7 +154,7 @@ export function threadScrollTargetTop(
const SCROLL_POS_KEY_BASE = 'hermes.desktop.threadScroll.v1'
export function threadScrollStorageKey(profile: string): string {
return `${SCROLL_POS_KEY_BASE}.profile.${encodeURIComponent(normalizeProfileKey(profile))}`
return `${SCROLL_POS_KEY_BASE}.profile.${encodeURIComponent(normalizeProfileKey(profile))}${activeConnectionScopeSuffix()}`
}
// Bounded so a marathon runtime that touches hundreds of sessions doesn't grow
@@ -172,7 +173,12 @@ function isValidState(value: unknown): value is ThreadScrollState {
return true
}
return record.kind === 'offset' && typeof record.fromBottom === 'number' && Number.isFinite(record.fromBottom)
return (
record.kind === 'offset' &&
typeof record.fromBottom === 'number' &&
Number.isFinite(record.fromBottom) &&
record.fromBottom >= 0
)
}
function loadPositions(profile: string): Record<string, ThreadScrollState> {