mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-25 01:08:50 +01:00
Fix missing posts due to GC
Hidden/collapsed comments are not mounted so they got accidentally GC-ed
This commit is contained in:
parent
b269d9d660
commit
fecebc24a8
2 changed files with 11 additions and 2 deletions
|
@ -72,7 +72,9 @@ window.__STATES_STATS__ = () => {
|
||||||
const { statuses } = states;
|
const { statuses } = states;
|
||||||
const unmountedPosts = [];
|
const unmountedPosts = [];
|
||||||
for (const key in statuses) {
|
for (const key in statuses) {
|
||||||
const $post = document.querySelector(`[data-state-post-id="${key}"]`);
|
const $post = document.querySelector(
|
||||||
|
`[data-state-post-id="${key}"], [data-state-post-ids~="${key}"]`,
|
||||||
|
);
|
||||||
if (!$post) {
|
if (!$post) {
|
||||||
unmountedPosts.push(key);
|
unmountedPosts.push(key);
|
||||||
}
|
}
|
||||||
|
@ -89,8 +91,11 @@ setInterval(() => {
|
||||||
let keysCount = 0;
|
let keysCount = 0;
|
||||||
const { instance } = api();
|
const { instance } = api();
|
||||||
for (const key in statuses) {
|
for (const key in statuses) {
|
||||||
|
if (!window.__IDLE__) break;
|
||||||
try {
|
try {
|
||||||
const $post = document.querySelector(`[data-state-post-id~="${key}"]`);
|
const $post = document.querySelector(
|
||||||
|
`[data-state-post-id="${key}"], [data-state-post-ids~="${key}"]`,
|
||||||
|
);
|
||||||
const postInNotifications = notifications.some(
|
const postInNotifications = notifications.some(
|
||||||
(n) => key === statusKey(n.status?.id, instance),
|
(n) => key === statusKey(n.status?.id, instance),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1137,6 +1137,10 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
||||||
disabled={uiState === 'loading'}
|
disabled={uiState === 'loading'}
|
||||||
onClick={() => setLimit((l) => l + LIMIT)}
|
onClick={() => setLimit((l) => l + LIMIT)}
|
||||||
style={{ marginBlockEnd: '6em' }}
|
style={{ marginBlockEnd: '6em' }}
|
||||||
|
data-state-post-ids={statuses
|
||||||
|
.slice(limit)
|
||||||
|
.map((s) => statusKey(s.id, instance))
|
||||||
|
.join(' ')}
|
||||||
>
|
>
|
||||||
<div class="ib avatars-bunch">
|
<div class="ib avatars-bunch">
|
||||||
{/* show avatars for first 5 statuses */}
|
{/* show avatars for first 5 statuses */}
|
||||||
|
|
Loading…
Reference in a new issue