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