Experiment dynamic change of parent
This might prevent double renders
This commit is contained in:
parent
57390a291b
commit
304ce5a3e8
|
@ -11,6 +11,7 @@ import {
|
|||
import { decodeBlurHash, getBlurHashAverageColor } from 'fast-blurhash';
|
||||
import { shallowEqual } from 'fast-equals';
|
||||
import prettify from 'html-prettify';
|
||||
import { Fragment } from 'preact';
|
||||
import { memo } from 'preact/compat';
|
||||
import {
|
||||
useCallback,
|
||||
|
@ -406,8 +407,7 @@ function Status({
|
|||
}
|
||||
|
||||
// Check followedTags
|
||||
if (showFollowedTags && !!snapStates.statusFollowedTags[sKey]?.length) {
|
||||
return (
|
||||
const FollowedTagsParent = ({ children }) => (
|
||||
<div
|
||||
data-state-post-id={sKey}
|
||||
class="status-followed-tags"
|
||||
|
@ -425,19 +425,13 @@ function Status({
|
|||
</Link>
|
||||
))}
|
||||
</div>
|
||||
<Status
|
||||
status={statusID ? null : status}
|
||||
statusID={statusID ? status.id : null}
|
||||
instance={instance}
|
||||
size={size}
|
||||
contentTextWeight={contentTextWeight}
|
||||
readOnly={readOnly}
|
||||
enableCommentHint
|
||||
mediaFirst={mediaFirst}
|
||||
/>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const StatusParent =
|
||||
showFollowedTags && !!snapStates.statusFollowedTags[sKey]?.length
|
||||
? FollowedTagsParent
|
||||
: Fragment;
|
||||
|
||||
const isSizeLarge = size === 'l';
|
||||
|
||||
|
@ -1383,7 +1377,7 @@ function Status({
|
|||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<StatusParent>
|
||||
{showReplyParent && !!(inReplyToId && inReplyToAccountId) && (
|
||||
<StatusCompact sKey={sKey} />
|
||||
)}
|
||||
|
@ -2251,7 +2245,7 @@ function Status({
|
|||
</Modal>
|
||||
)}
|
||||
</article>
|
||||
</>
|
||||
</StatusParent>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue