mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +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);
|
return STATUS_URL_REGEX.test(states.prevLocation?.pathname);
|
||||||
}, [sKey]);
|
}, [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 (
|
return (
|
||||||
<div
|
<div
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
|
@ -1156,10 +1169,7 @@ 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
|
data-state-post-ids={moreStatusesKeys.join(' ')}
|
||||||
.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