+8
-5
src/components/TimelineView.svelte
+8
-5
src/components/TimelineView.svelte
···
65
65
try {
66
66
await fetchTimeline(client, did, 7, showReplies);
67
67
// only fetch interactions if logged in (because if not who is the interactor)
68
-
if (client.user) {
68
+
if (client.user && userDid) {
69
69
if (!fetchingInteractions) {
70
70
scheduledFetchInteractions = false;
71
71
fetchingInteractions = true;
72
-
fetchInteractionsToTimelineEnd(client, did).finally(() => (fetchingInteractions = false));
72
+
await fetchInteractionsToTimelineEnd(client, userDid, did);
73
+
fetchingInteractions = false;
73
74
} else {
74
75
scheduledFetchInteractions = true;
75
76
}
···
99
100
100
101
let fetchingInteractions = $state(false);
101
102
let scheduledFetchInteractions = $state(false);
102
-
// we want to load interactions when changing logged in user on timelines
103
+
// we want to load interactions when changing logged in user
103
104
// only on timelines that arent logged in users, because those are already
104
105
// loaded by loadMore
105
106
$effect(() => {
106
-
if (client && did && scheduledFetchInteractions && userDid !== did) {
107
+
if (client && scheduledFetchInteractions && userDid && did && did !== userDid) {
107
108
if (!fetchingInteractions) {
108
109
scheduledFetchInteractions = false;
109
110
fetchingInteractions = true;
110
-
fetchInteractionsToTimelineEnd(client, did).finally(() => (fetchingInteractions = false));
111
+
fetchInteractionsToTimelineEnd(client, userDid, did).finally(
112
+
() => (fetchingInteractions = false)
113
+
);
111
114
} else {
112
115
scheduledFetchInteractions = true;
113
116
}
+1
-1
src/lib/result.ts
+1
-1
src/lib/result.ts
···
12
12
return { ok: true, value };
13
13
};
14
14
export const err = <E>(error: E): Err<E> => {
15
-
console.error(error);
15
+
// console.error(error);
16
16
return { ok: false, error };
17
17
};
18
18
export const expect = <T, E>(v: Result<T, E>, msg: string = 'expected result to not be error:') => {
+7
-3
src/lib/state.svelte.ts
+7
-3
src/lib/state.svelte.ts
···
512
512
return newCursor;
513
513
};
514
514
515
-
export const fetchInteractionsToTimelineEnd = async (client: AtpClient, did: Did) => {
516
-
const cursor = postCursors.get(did);
515
+
export const fetchInteractionsToTimelineEnd = async (
516
+
client: AtpClient,
517
+
interactor: Did,
518
+
subject: Did
519
+
) => {
520
+
const cursor = postCursors.get(subject);
517
521
if (!cursor) return;
518
522
const timestamp = timestampFromCursor(cursor.value);
519
523
await Promise.all(
520
-
[likeSource, repostSource].map((s) => fetchLinksUntil(did, client, s, timestamp))
524
+
[likeSource, repostSource].map((s) => fetchLinksUntil(interactor, client, s, timestamp))
521
525
);
522
526
};
523
527