From ddabe5082d00a427b7cedf5c2bd803da7dad2607 Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Thu, 19 Mar 2026 18:12:52 +0100 Subject: [PATCH] feat: show skeleton loaders while ATProto identity resolves - Show skeleton in PublicNoteView and StackedPublicNote while note content is pending author resolution - Show skeleton h1 in PublicNoteListByDidView while author loads - Show skeleton in SignInAtproto until auth state is known - Load cached session from IndexedDB before OAuth restore so the homepage resolves immediately without waiting for network --- src/components/SignInAtproto.vue | 7 ++++--- src/components/StackedPublicNote.vue | 4 +++- src/hooks/useATProtoLogin.hook.ts | 11 ++++++----- src/views/PublicNoteListByDidView.vue | 6 ++++-- src/views/PublicNoteView.vue | 4 +++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/components/SignInAtproto.vue b/src/components/SignInAtproto.vue index d71d706..ad545f1 100644 --- a/src/components/SignInAtproto.vue +++ b/src/components/SignInAtproto.vue @@ -3,7 +3,7 @@ import { ref } from "vue" import { useATProtoLogin } from "@/hooks/useATProtoLogin.hook" -const { handle, isLoggedIn, signIn, signOut } = useATProtoLogin() +const { handle, isLoggedIn, isATProtoReady, signIn, signOut } = useATProtoLogin() withDefaults( defineProps<{ @@ -24,13 +24,14 @@ const onSignIn = () => { diff --git a/src/hooks/useATProtoLogin.hook.ts b/src/hooks/useATProtoLogin.hook.ts index f5cdbaf..7106592 100644 --- a/src/hooks/useATProtoLogin.hook.ts +++ b/src/hooks/useATProtoLogin.hook.ts @@ -10,8 +10,13 @@ const handle = ref(null) let init = true const initializeAuth = async () => { - const session = await restoreSession() + // Load cached session from IndexedDB first (fast, local) so the UI can render immediately + const stored = await loadSession() + did.value = stored?.did ?? '' + handle.value = stored?.handle ?? '' + // Then restore OAuth session in the background (may involve network) + const session = await restoreSession() if (session) { const author = await getAuthor(session.did) const resolvedHandle = author?.handle ?? '' @@ -21,10 +26,6 @@ const initializeAuth = async () => { await saveSession(session.did, resolvedHandle) window.history.replaceState(null, '', window.location.pathname + window.location.search) - } else { - const stored = await loadSession() - did.value = stored?.did ?? '' - handle.value = stored?.handle ?? '' } } diff --git a/src/views/PublicNoteListByDidView.vue b/src/views/PublicNoteListByDidView.vue index 992a592..2f1be53 100644 --- a/src/views/PublicNoteListByDidView.vue +++ b/src/views/PublicNoteListByDidView.vue @@ -1,6 +1,7 @@