Queue all the microtasks

This commit is contained in:
Lim Chee Aun 2023-12-29 08:25:58 +08:00
parent 71d2db31e0
commit a97478097b

View file

@ -175,21 +175,25 @@ export function saveStatus(status, instance, opts) {
if (!status) return;
const oldStatus = getStatus(status.id, instance);
if (!override && oldStatus) return;
const key = statusKey(status.id, instance);
if (oldStatus?._pinned) status._pinned = oldStatus._pinned;
// if (oldStatus?._filtered) status._filtered = oldStatus._filtered;
states.statuses[key] = status;
if (status.reblog) {
const key = statusKey(status.reblog.id, instance);
states.statuses[key] = status.reblog;
}
queueMicrotask(() => {
const key = statusKey(status.id, instance);
if (oldStatus?._pinned) status._pinned = oldStatus._pinned;
// if (oldStatus?._filtered) status._filtered = oldStatus._filtered;
states.statuses[key] = status;
if (status.reblog) {
const key = statusKey(status.reblog.id, instance);
states.statuses[key] = status.reblog;
}
});
// THREAD TRAVERSER
if (!skipThreading) {
queueMicrotask(() => {
threadifyStatus(status, instance);
if (status.reblog) {
threadifyStatus(status.reblog, instance);
queueMicrotask(() => {
threadifyStatus(status.reblog, instance);
});
}
});
}