From cfe41cb802834b5049e906bee7cef2de4981e0a9 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Wed, 27 Dec 2023 23:32:52 +0800 Subject: [PATCH] Test queueMicrotask --- src/utils/enhance-content.js | 3 ++- src/utils/states.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/enhance-content.js b/src/utils/enhance-content.js index 449c87ec..97077c8f 100644 --- a/src/utils/enhance-content.js +++ b/src/utils/enhance-content.js @@ -244,7 +244,8 @@ function _enhanceContent(content, opts = {}) { } if (postEnhanceDOM) { - postEnhanceDOM(dom); // mutate dom + queueMicrotask(() => postEnhanceDOM(dom)); + // postEnhanceDOM(dom); // mutate dom } enhancedContent = dom.innerHTML; diff --git a/src/utils/states.js b/src/utils/states.js index ab422a7d..9328f8dd 100644 --- a/src/utils/states.js +++ b/src/utils/states.js @@ -180,7 +180,7 @@ export function saveStatus(status, instance, opts) { // THREAD TRAVERSER if (!skipThreading) { - requestAnimationFrame(() => { + queueMicrotask(() => { threadifyStatus(status, instance); if (status.reblog) { threadifyStatus(status.reblog, instance);