grain.social is a photo sharing platform built on atproto. grain.social
atproto photography appview
57
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: derive isAuthenticated from $page.data instead of writable store

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+3 -6
-1
app/lib/components/organisms/AuthBar.svelte
··· 10 10 async function doLogout() { 11 11 await logout() 12 12 resetPreferences() 13 - $isAuthenticated = false 14 13 $viewer = null 15 14 window.location.href = '/' 16 15 }
-1
app/lib/components/organisms/MobileDrawer.svelte
··· 24 24 async function doLogout() { 25 25 await logout() 26 26 resetPreferences() 27 - $isAuthenticated = false 28 27 $viewer = null 29 28 window.location.href = '/' 30 29 }
+3 -2
app/lib/stores.ts
··· 1 - import { writable } from "svelte/store"; 1 + import { writable, derived } from "svelte/store"; 2 + import { page } from "$app/stores"; 2 3 3 4 export interface ViewerProfile { 4 5 did: string; ··· 8 9 } 9 10 10 11 export const viewer = writable<ViewerProfile | null>(null); 11 - export const isAuthenticated = writable(false); 12 + export const isAuthenticated = derived(page, ($page) => !!$page.data?.viewer); 12 13 export const loginModalOpen = writable(false); 13 14 14 15 /** Check auth and open login modal if not authenticated. Returns true if authenticated. */
-2
app/routes/+layout.svelte
··· 27 27 28 28 $effect(() => { 29 29 if (data.viewer) { 30 - $isAuthenticated = true 31 30 $viewer = { did: data.viewer.did, handle: data.viewer.handle ?? null, displayName: data.viewer.handle ?? data.viewer.did.slice(0, 18), avatar: null } 32 31 Promise.resolve(data.profile).then((profile) => { 33 32 if (profile) { ··· 40 39 } 41 40 }) 42 41 } else { 43 - $isAuthenticated = false 44 42 $viewer = null 45 43 } 46 44 })