createTimeline: fix the mutate won't work
This commit is contained in:
parent
44c9e55928
commit
23dc34dbbf
1 changed files with 20 additions and 15 deletions
|
@ -288,11 +288,13 @@ export function createTimeline<
|
|||
}
|
||||
});
|
||||
|
||||
untrack(() => {
|
||||
for (const status of chk.chunk) {
|
||||
const node = untrack(() => lookup.get(status.id))!;
|
||||
const parent = untrack(() =>
|
||||
status.inReplyToId ? lookup.get(status.inReplyToId) : undefined,
|
||||
);
|
||||
const node = lookup.get(status.id)!;
|
||||
const parent = status.inReplyToId
|
||||
? lookup.get(status.inReplyToId)
|
||||
: undefined;
|
||||
|
||||
if (parent) {
|
||||
const children = parent.children ?? [];
|
||||
if (!children.find((x) => x.value.id == status.id)) {
|
||||
|
@ -302,6 +304,7 @@ export function createTimeline<
|
|||
node.parent = parent;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const nThreadIds = chk.chunk
|
||||
.filter((x, i) => !existence[i])
|
||||
|
@ -314,11 +317,13 @@ export function createTimeline<
|
|||
setThreads((threads) => [...nThreadIds, ...threads]);
|
||||
}
|
||||
|
||||
untrack(() => {
|
||||
setThreads((threads) =>
|
||||
threads.filter((id) => (lookup.get(id)!.children?.length ?? 0) === 0),
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return [
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue