replies timeline only, appview-less bluesky client

fix infinite loading bug if repo has no posts, fix build

ptr.pet 49cfbb91 e3822ccf

verified
Changed files
+14 -3
src
components
lib
routes
[...catchall]
+7 -1
src/components/TimelineView.svelte
··· 80 80 }; 81 81 82 82 $effect(() => { 83 - if (threads.length === 0 && !loading && did) loadMore(); 83 + if (threads.length === 0 && !loading && did) { 84 + // if we saw all posts dont try to load more. 85 + // this only really happens if the user has no posts at all 86 + // but we do have to handle it to not cause an infinite loop 87 + const cursor = did ? postCursors.get(did as AtprotoDid) : undefined; 88 + if (!cursor?.end) loadMore(); 89 + } 84 90 if (client && did && fetchMoreInteractions) { 85 91 // set to false so it doesnt attempt to fetch again while its already fetching 86 92 fetchMoreInteractions = false;
+1 -1
src/lib/at/client.ts
··· 196 196 if (!res.ok) return res; 197 197 data.cursor = res.value.cursor; 198 198 data.records.push(...res.value.records); 199 - end = !data.cursor; 199 + end = data.records.length === 0 || !data.cursor; 200 200 if (!end && timestamp > 0) { 201 201 const cursorTimestamp = timestampFromCursor(data.cursor); 202 202 if (cursorTimestamp === undefined) {
+2
src/routes/[...catchall]/+page.ts
··· 5 5 import { err, ok, type Result } from '$lib/result'; 6 6 import type { PageLoad } from './$types'; 7 7 8 + export const prerender = false; 9 + 8 10 export type PageProps = { 9 11 data: { 10 12 client: Result<AtpClient | null, string>;
+4 -1
svelte.config.js
··· 11 11 // adapter-auto only supports some environments, see https://svelte.dev/docs/kit/adapter-auto for a list. 12 12 // If your environment is not supported, or you settled on a specific environment, switch out the adapter. 13 13 // See https://svelte.dev/docs/kit/adapters for more information about adapters. 14 - adapter: adapter(), 14 + adapter: adapter({ 15 + fallback: 'index.html', 16 + precompress: true 17 + }), 15 18 alias: { 16 19 $lib: 'src/lib', 17 20 '$lib/*': 'src/lib/*',