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
This commit is contained in:
Julien Calixte
2026-03-19 18:12:52 +01:00
parent 52561496b4
commit ddabe5082d
5 changed files with 20 additions and 12 deletions

View File

@@ -10,8 +10,13 @@ const handle = ref<string | null>(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 ?? ''
}
}