···11<script lang="ts">
22 import BskyPost from './BskyPost.svelte';
33 import { type State as PostComposerState } from './PostComposer.svelte';
44- import { AtpClient } from '$lib/at/client';
44+ import { AtpClient } from '$lib/at/client.svelte';
55 import { accounts } from '$lib/accounts';
66 import { type ResourceUri } from '@atcute/lexicons';
77 import { SvelteSet } from 'svelte/reactivity';
···3939 let viewOwnPosts = $state(true);
4040 const expandedThreads = new SvelteSet<ResourceUri>();
41414242- const did = $derived(targetDid ?? client?.user?.did);
4242+ const userDid = $derived(client?.user?.did);
4343+ const did = $derived(targetDid ?? userDid);
43444445 const threads = $derived(
4546 // todo: apply showReplies here
···6465 try {
6566 await fetchTimeline(client, did as AtprotoDid, 7, showReplies);
6667 // only fetch interactions if logged in (because if not who is the interactor)
6767- if (client.user) await fetchInteractionsToTimelineEnd(client, did);
6868+ if (client.user) {
6969+ if (!fetchingInteractions) {
7070+ scheduledFetchInteractions = false;
7171+ fetchingInteractions = true;
7272+ fetchInteractionsToTimelineEnd(client, did).finally(() => (fetchingInteractions = false));
7373+ } else {
7474+ scheduledFetchInteractions = true;
7575+ }
7676+ }
6877 loaderState.loaded();
6978 } catch (error) {
7079 loadError = `${error}`;
···7988 };
80898190 $effect(() => {
8282- if (threads.length === 0 && !loading && did) {
9191+ if (threads.length === 0 && !loading && userDid && did) {
8392 // if we saw all posts dont try to load more.
8493 // this only really happens if the user has no posts at all
8594 // but we do have to handle it to not cause an infinite loop
···8796 if (!cursor?.end) loadMore();
8897 }
8998 });
9999+100100+ let fetchingInteractions = $state(false);
101101+ let scheduledFetchInteractions = $state(false);
90102 // we want to load interactions when changing logged in user on timelines
91103 // only on timelines that arent logged in users, because those are already
92104 // loaded by loadMore
93105 $effect(() => {
9494- if (client && did && client.user?.did !== did) fetchInteractionsToTimelineEnd(client, did);
106106+ if (client && did && scheduledFetchInteractions && userDid !== did) {
107107+ if (!fetchingInteractions) {
108108+ scheduledFetchInteractions = false;
109109+ fetchingInteractions = true;
110110+ fetchInteractionsToTimelineEnd(client, did).finally(() => (fetchingInteractions = false));
111111+ } else {
112112+ scheduledFetchInteractions = true;
113113+ }
114114+ }
95115 });
96116</script>
97117
···44 type Cid,
55 type ResourceUri
66} from '@atcute/lexicons';
77-import { type AtpClient } from './client';
77+import { type AtpClient } from './client.svelte';
88import { err, expect, ok, type Ok, type Result } from '$lib/result';
99import type { Backlinks } from './constellation';
1010import { AppBskyFeedPost } from '@atcute/bluesky';
+1-1
src/lib/richtext/index.ts
···11import RichtextBuilder, { type BakedRichtext } from '@atcute/bluesky-richtext-builder';
22import { tokenize, type Token } from '$lib/richtext/parser';
33import type { Did, GenericUri, Handle } from '@atcute/lexicons';
44-import { resolveHandle } from '$lib/at/client';
44+import { resolveHandle } from '$lib/at/client.svelte';
5566export const parseToRichText = (text: string): ReturnType<typeof processTokens> =>
77 processTokens(tokenize(text));
···11import { addAccount, loggingIn } from '$lib/accounts';
22-import { AtpClient } from '$lib/at/client';
22+import { AtpClient } from '$lib/at/client.svelte';
33import { flow, sessions } from '$lib/at/oauth';
44import { err, ok, type Result } from '$lib/result';
55import type { PageLoad } from './$types';