mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-22 16:46:28 +01:00
Fix child replies accidentally got GC-ed
This commit is contained in:
parent
32d32b72f4
commit
096bc69584
1 changed files with 14 additions and 4 deletions
|
@ -901,6 +901,19 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
|||
return STATUS_URL_REGEX.test(states.prevLocation?.pathname);
|
||||
}, [sKey]);
|
||||
|
||||
const moreStatusesKeys = useMemo(() => {
|
||||
if (!showMore) return [];
|
||||
const ids = [];
|
||||
function getIDs(status) {
|
||||
ids.push(status.id);
|
||||
if (status.replies) {
|
||||
status.replies.forEach(getIDs);
|
||||
}
|
||||
}
|
||||
statuses.slice(limit).forEach(getIDs);
|
||||
return ids.map((id) => statusKey(id, instance));
|
||||
}, [showMore, statuses, limit, instance]);
|
||||
|
||||
return (
|
||||
<div
|
||||
tabIndex="-1"
|
||||
|
@ -1156,10 +1169,7 @@ function StatusThread({ id, closeLink = '/', instance: propInstance }) {
|
|||
disabled={uiState === 'loading'}
|
||||
onClick={() => setLimit((l) => l + LIMIT)}
|
||||
style={{ marginBlockEnd: '6em' }}
|
||||
data-state-post-ids={statuses
|
||||
.slice(limit)
|
||||
.map((s) => statusKey(s.id, instance))
|
||||
.join(' ')}
|
||||
data-state-post-ids={moreStatusesKeys.join(' ')}
|
||||
>
|
||||
<div class="ib avatars-bunch">
|
||||
{/* show avatars for first 5 statuses */}
|
||||
|
|
Loading…
Reference in a new issue