From 90df455d6e0701efb9e4674ee936c25ac4266adf Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 6 Nov 2023 16:47:35 +0800 Subject: [PATCH] Prevent GC posts from notifications --- src/app.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app.jsx b/src/app.jsx index 26b5d1a5..44d937ad 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -85,12 +85,16 @@ window.__STATES_STATS__ = () => { // Only posts for now setInterval(() => { if (!window.__IDLE__) return; - const { statuses, unfurledLinks } = states; + const { statuses, unfurledLinks, notifications } = states; let keysCount = 0; + const { instance } = api(); for (const key in statuses) { try { const $post = document.querySelector(`[data-state-post-id~="${key}"]`); - if (!$post) { + const postInNotifications = notifications.some( + (n) => key === statusKey(n.status?.id, instance), + ); + if (!$post && !postInNotifications) { delete states.statuses[key]; delete states.statusQuotes[key]; for (const link in unfurledLinks) {