fix scroll when no session exists

This commit is contained in:
Dax Raad
2025-11-07 13:22:03 -05:00
parent c6eea0343d
commit 4463d319c9
2 changed files with 16 additions and 8 deletions

View File

@@ -2,7 +2,7 @@ import { useDialog } from "@tui/ui/dialog"
import { DialogSelect } from "@tui/ui/dialog-select"
import { useRoute } from "@tui/context/route"
import { useSync } from "@tui/context/sync"
import { createMemo, createSignal, onMount } from "solid-js"
import { createEffect, createMemo, createSignal, onMount } from "solid-js"
import { Locale } from "@/util/locale"
import { Keybind } from "@/util/keybind"
import { useTheme } from "../context/theme"
@@ -45,6 +45,10 @@ export function DialogSessionList() {
})
})
createEffect(() => {
console.log("session count", sync.data.session.length)
})
onMount(() => {
dialog.setSize("large")
})

View File

@@ -107,14 +107,18 @@ export function Session() {
const contentWidth = createMemo(() => dimensions().width - (sidebarVisible() ? 42 : 0) - 4)
createEffect(async () => {
await sync.session.sync(route.sessionID).catch(() => {
toast.show({
message: `Session not found: ${route.sessionID}`,
variant: "error",
await sync.session
.sync(route.sessionID)
.then(() => {
scroll.scrollBy(100_000)
})
.catch(() => {
toast.show({
message: `Session not found: ${route.sessionID}`,
variant: "error",
})
return navigate({ type: "home" })
})
return navigate({ type: "home" })
})
scroll.scrollBy(100_000)
})
const toast = useToast()