[Perf] Message / Reactions: Drop ineffective shouldDelayInit optimization
This commit is contained in:
parent
3ac3ad394b
commit
ec6a28baf6
@ -36,7 +36,6 @@ type OwnProps = {
|
||||
shouldPause?: boolean;
|
||||
shouldLoop?: boolean;
|
||||
loopLimit?: number;
|
||||
shouldDelayInit?: boolean;
|
||||
observeIntersection?: ObserveFn;
|
||||
};
|
||||
|
||||
@ -67,7 +66,6 @@ const ReactionAnimatedEmoji = ({
|
||||
shouldPause,
|
||||
shouldLoop,
|
||||
loopLimit,
|
||||
shouldDelayInit,
|
||||
observeIntersection,
|
||||
}: OwnProps & StateProps) => {
|
||||
const { stopActiveReaction } = getActions();
|
||||
@ -169,7 +167,6 @@ const ReactionAnimatedEmoji = ({
|
||||
size={size}
|
||||
noPlay={shouldPause}
|
||||
loopLimit={loopLimit}
|
||||
forceAlways={!shouldDelayInit}
|
||||
observeIntersectionForPlaying={observeIntersection}
|
||||
/>
|
||||
)}
|
||||
@ -181,7 +178,6 @@ const ReactionAnimatedEmoji = ({
|
||||
tgsUrl={mediaDataCenterIcon}
|
||||
play={isIntersecting && !shouldPause}
|
||||
noLoop={!shouldLoop}
|
||||
forceAlways={!shouldDelayInit}
|
||||
onLoad={markAnimationLoaded}
|
||||
onEnded={unmarkAnimationLoaded}
|
||||
/>
|
||||
@ -195,7 +191,6 @@ const ReactionAnimatedEmoji = ({
|
||||
tgsUrl={mediaDataEffect}
|
||||
play={isIntersecting}
|
||||
noLoop
|
||||
forceAlways={!shouldDelayInit}
|
||||
onEnded={handleEnded}
|
||||
/>
|
||||
{isCustom && !assignedEffectId && isIntersecting && (
|
||||
|
||||
@ -1045,7 +1045,6 @@ const Message: FC<OwnProps & StateProps> = ({
|
||||
noRecentReactors={isChannel}
|
||||
tags={tags}
|
||||
isCurrentUserPremium={isPremium}
|
||||
getIsMessageListReady={getIsMessageListReady}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@ -1650,7 +1649,6 @@ const Message: FC<OwnProps & StateProps> = ({
|
||||
observeIntersection={observeIntersectionForPlaying}
|
||||
noRecentReactors={isChannel}
|
||||
tags={tags}
|
||||
getIsMessageListReady={getIsMessageListReady}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@ -28,7 +28,6 @@ type OwnProps = {
|
||||
recentReactors?: ApiPeer[];
|
||||
className?: string;
|
||||
chosenClassName?: string;
|
||||
shouldDelayInit?: boolean;
|
||||
observeIntersection?: ObserveFn;
|
||||
onClick?: (reaction: ApiReaction) => void;
|
||||
};
|
||||
@ -40,7 +39,6 @@ const ReactionButton = ({
|
||||
recentReactors,
|
||||
className,
|
||||
chosenClassName,
|
||||
shouldDelayInit,
|
||||
observeIntersection,
|
||||
onClick,
|
||||
}: OwnProps) => {
|
||||
@ -66,7 +64,6 @@ const ReactionButton = ({
|
||||
reaction={reaction.reaction}
|
||||
size={REACTION_SIZE}
|
||||
observeIntersection={observeIntersection}
|
||||
shouldDelayInit={shouldDelayInit}
|
||||
/>
|
||||
{recentReactors?.length ? (
|
||||
<AvatarList size="mini" peers={recentReactors} />
|
||||
|
||||
@ -11,14 +11,12 @@ import type {
|
||||
} from '../../../../api/types';
|
||||
import type { ObserveFn } from '../../../../hooks/useIntersectionObserver';
|
||||
import type { ThreadId } from '../../../../types';
|
||||
import type { Signal } from '../../../../util/signals';
|
||||
|
||||
import { getReactionKey, isReactionChosen } from '../../../../global/helpers';
|
||||
import { selectPeer } from '../../../../global/selectors';
|
||||
import buildClassName from '../../../../util/buildClassName';
|
||||
import { getMessageKey } from '../../../../util/keys/messageKey';
|
||||
|
||||
import useDerivedState from '../../../../hooks/useDerivedState';
|
||||
import useLastCallback from '../../../../hooks/useLastCallback';
|
||||
import useOldLang from '../../../../hooks/useOldLang';
|
||||
|
||||
@ -37,7 +35,6 @@ type OwnProps = {
|
||||
isCurrentUserPremium?: boolean;
|
||||
observeIntersection?: ObserveFn;
|
||||
noRecentReactors?: boolean;
|
||||
getIsMessageListReady: Signal<boolean>;
|
||||
};
|
||||
|
||||
const MAX_RECENT_AVATARS = 3;
|
||||
@ -52,7 +49,6 @@ const Reactions: FC<OwnProps> = ({
|
||||
noRecentReactors,
|
||||
isCurrentUserPremium,
|
||||
tags,
|
||||
getIsMessageListReady,
|
||||
}) => {
|
||||
const {
|
||||
toggleReaction,
|
||||
@ -68,8 +64,6 @@ const Reactions: FC<OwnProps> = ({
|
||||
results.reduce((acc, reaction) => acc + reaction.count, 0)
|
||||
), [results]);
|
||||
|
||||
const isMessageListReady = useDerivedState(getIsMessageListReady);
|
||||
|
||||
const recentReactorsByReactionKey = useMemo(() => {
|
||||
const global = getGlobal();
|
||||
|
||||
@ -158,7 +152,6 @@ const Reactions: FC<OwnProps> = ({
|
||||
onClick={handleClick}
|
||||
onRemove={handleRemoveReaction}
|
||||
observeIntersection={observeIntersection}
|
||||
shouldDelayInit={!isMessageListReady}
|
||||
/>
|
||||
) : (
|
||||
<ReactionButton
|
||||
@ -171,7 +164,6 @@ const Reactions: FC<OwnProps> = ({
|
||||
reaction={reaction}
|
||||
onClick={handleClick}
|
||||
observeIntersection={observeIntersection}
|
||||
shouldDelayInit={!isMessageListReady}
|
||||
/>
|
||||
)
|
||||
))}
|
||||
|
||||
@ -38,7 +38,6 @@ type OwnProps = {
|
||||
chosenClassName?: string;
|
||||
isDisabled?: boolean;
|
||||
withContextMenu?: boolean;
|
||||
shouldDelayInit?: boolean;
|
||||
observeIntersection?: ObserveFn;
|
||||
onClick?: (reaction: ApiReaction) => void;
|
||||
onRemove?: (reaction: ApiReaction) => void;
|
||||
@ -55,7 +54,6 @@ const SavedTagButton = ({
|
||||
withCount,
|
||||
isDisabled,
|
||||
withContextMenu,
|
||||
shouldDelayInit,
|
||||
observeIntersection,
|
||||
onClick,
|
||||
onRemove,
|
||||
@ -141,7 +139,6 @@ const SavedTagButton = ({
|
||||
loopLimit={LOOP_LIMIT}
|
||||
size={REACTION_SIZE}
|
||||
observeIntersection={observeIntersection}
|
||||
shouldDelayInit={shouldDelayInit}
|
||||
/>
|
||||
{hasText && (
|
||||
<span className={styles.tagText}>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user