Middle Header: Fix cleaning up after transition
This commit is contained in:
parent
9fbd0b7841
commit
e0b096227f
@ -48,6 +48,7 @@ import useCurrentOrPrev from '../../hooks/useCurrentOrPrev';
|
|||||||
import buildClassName from '../../util/buildClassName';
|
import buildClassName from '../../util/buildClassName';
|
||||||
import useLang from '../../hooks/useLang';
|
import useLang from '../../hooks/useLang';
|
||||||
import useConnectionStatus from '../../hooks/useConnectionStatus';
|
import useConnectionStatus from '../../hooks/useConnectionStatus';
|
||||||
|
import usePrevious from '../../hooks/usePrevious';
|
||||||
|
|
||||||
import PrivateChatInfo from '../common/PrivateChatInfo';
|
import PrivateChatInfo from '../common/PrivateChatInfo';
|
||||||
import GroupChatInfo from '../common/GroupChatInfo';
|
import GroupChatInfo from '../common/GroupChatInfo';
|
||||||
@ -262,6 +263,11 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
|||||||
const renderingCanUnpin = useCurrentOrPrev(canUnpin, true);
|
const renderingCanUnpin = useCurrentOrPrev(canUnpin, true);
|
||||||
const renderingPinnedMessageTitle = useCurrentOrPrev(topMessageTitle);
|
const renderingPinnedMessageTitle = useCurrentOrPrev(topMessageTitle);
|
||||||
|
|
||||||
|
const prevTransitionKey = usePrevious(currentTransitionKey);
|
||||||
|
const cleanupExceptionKey = (
|
||||||
|
prevTransitionKey !== undefined && prevTransitionKey < currentTransitionKey ? prevTransitionKey : undefined
|
||||||
|
);
|
||||||
|
|
||||||
const canRevealTools = (shouldRenderPinnedMessage && renderingPinnedMessage)
|
const canRevealTools = (shouldRenderPinnedMessage && renderingPinnedMessage)
|
||||||
|| (shouldRenderAudioPlayer && renderingAudioMessage);
|
|| (shouldRenderAudioPlayer && renderingAudioMessage);
|
||||||
|
|
||||||
@ -388,6 +394,8 @@ const MiddleHeader: FC<OwnProps & StateProps> = ({
|
|||||||
<Transition
|
<Transition
|
||||||
name={shouldSkipHistoryAnimations ? 'none' : 'slide-fade'}
|
name={shouldSkipHistoryAnimations ? 'none' : 'slide-fade'}
|
||||||
activeKey={currentTransitionKey}
|
activeKey={currentTransitionKey}
|
||||||
|
shouldCleanup
|
||||||
|
cleanupExceptionKey={cleanupExceptionKey}
|
||||||
>
|
>
|
||||||
{renderInfo()}
|
{renderInfo()}
|
||||||
</Transition>
|
</Transition>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user