[Perf] Clean-up invisible secondary sections
This commit is contained in:
parent
3f5c8edceb
commit
73b1d105c3
@ -243,6 +243,8 @@ const LeftColumn: FC<StateProps & DispatchProps> = ({
|
||||
name={IS_SINGLE_COLUMN_LAYOUT ? 'slide-layers' : 'push-slide'}
|
||||
renderCount={RENDER_COUNT}
|
||||
activeKey={contentType}
|
||||
shouldCleanup
|
||||
cleanupExceptionKey={ContentType.Main}
|
||||
>
|
||||
{(isActive) => {
|
||||
switch (contentType) {
|
||||
|
||||
@ -122,7 +122,13 @@ const LeftMain: FC<OwnProps & StateProps> = ({
|
||||
onReset={onReset}
|
||||
/>
|
||||
<ConnectionState />
|
||||
<Transition name="zoom-fade" renderCount={TRANSITION_RENDER_COUNT} activeKey={content}>
|
||||
<Transition
|
||||
name="zoom-fade"
|
||||
renderCount={TRANSITION_RENDER_COUNT}
|
||||
activeKey={content}
|
||||
shouldCleanup
|
||||
cleanupExceptionKey={LeftColumnContent.ChatList}
|
||||
>
|
||||
{(isActive) => {
|
||||
switch (content) {
|
||||
case LeftColumnContent.ChatList:
|
||||
|
||||
@ -63,7 +63,7 @@ const LeftSearch: FC<OwnProps & StateProps & DispatchProps> = ({
|
||||
onReset,
|
||||
}) => {
|
||||
const lang = useLang();
|
||||
const [activeTab, setActiveTab] = useState(0);
|
||||
const [activeTab, setActiveTab] = useState(currentContent);
|
||||
const dateSearchQuery = useMemo(() => parseDateString(searchQuery), [searchQuery]);
|
||||
|
||||
const handleSwitchTab = useCallback((index: number) => {
|
||||
|
||||
@ -253,6 +253,8 @@ const RightColumn: FC<StateProps & DispatchProps> = ({
|
||||
name={shouldSkipTransition ? 'none' : 'zoom-fade'}
|
||||
renderCount={MAIN_SCREENS_COUNT + MANAGEMENT_SCREENS_COUNT}
|
||||
activeKey={isManagement ? MAIN_SCREENS_COUNT + managementScreen : renderingContentKey}
|
||||
shouldCleanup
|
||||
cleanupExceptionKey={RightColumnContent.ChatInfo}
|
||||
>
|
||||
{renderContent}
|
||||
</Transition>
|
||||
|
||||
@ -25,6 +25,7 @@ type OwnProps = {
|
||||
renderCount?: number;
|
||||
shouldRestoreHeight?: boolean;
|
||||
shouldCleanup?: boolean;
|
||||
cleanupExceptionKey?: number;
|
||||
id?: string;
|
||||
className?: string;
|
||||
onStart?: () => void;
|
||||
@ -55,6 +56,7 @@ const Transition: FC<OwnProps> = ({
|
||||
renderCount,
|
||||
shouldRestoreHeight,
|
||||
shouldCleanup,
|
||||
cleanupExceptionKey,
|
||||
id,
|
||||
className,
|
||||
onStart,
|
||||
@ -85,7 +87,7 @@ const Transition: FC<OwnProps> = ({
|
||||
|
||||
useLayoutEffect(() => {
|
||||
function cleanup() {
|
||||
if (!shouldCleanup) {
|
||||
if (!shouldCleanup || cleanupExceptionKey === prevActiveKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -212,6 +214,7 @@ const Transition: FC<OwnProps> = ({
|
||||
renderCount,
|
||||
shouldRestoreHeight,
|
||||
shouldCleanup,
|
||||
cleanupExceptionKey,
|
||||
animationLevel,
|
||||
forceUpdate,
|
||||
]);
|
||||
|
||||
@ -19,7 +19,7 @@ import { setLanguage } from '../../../util/langProvider';
|
||||
|
||||
addReducer('apiUpdate', (global, actions, update: ApiUpdate) => {
|
||||
if (DEBUG) {
|
||||
if (update['@type'] !== 'updateUserStatus') {
|
||||
if (update['@type'] !== 'updateUserStatus' && update['@type'] !== 'updateServerTimeOffset') {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('[GramJs] UPDATE', update['@type'], { update });
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user