Refactor smart components

Co-authored-by: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com>
This commit is contained in:
Jamie Kyle 2024-03-13 13:44:13 -07:00 committed by GitHub
parent 05c09ef769
commit 27b55e472d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
109 changed files with 3583 additions and 2629 deletions

View file

@ -1,9 +1,8 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React from 'react';
import React, { memo } from 'react';
import { useSelector } from 'react-redux';
import type { AppStateType } from '../ducks/app';
import type { StateType } from '../reducer';
import { Inbox } from '../../components/Inbox';
import { getIntl } from '../selectors/user';
@ -37,19 +36,19 @@ function renderStoriesTab() {
return <SmartStoriesTab />;
}
export function SmartInbox(): JSX.Element {
export const SmartInbox = memo(function SmartInbox(): JSX.Element {
const i18n = useSelector(getIntl);
const isCustomizingPreferredReactions = useSelector(
getIsCustomizingPreferredReactions
);
const envelopeTimestamp = useSelector<StateType, number | undefined>(
state => state.inbox.envelopeTimestamp
const envelopeTimestamp = useSelector(
(state: StateType) => state.inbox.envelopeTimestamp
);
const firstEnvelopeTimestamp = useSelector<StateType, number | undefined>(
state => state.inbox.firstEnvelopeTimestamp
const firstEnvelopeTimestamp = useSelector(
(state: StateType) => state.inbox.firstEnvelopeTimestamp
);
const { hasInitialLoadCompleted } = useSelector<StateType, AppStateType>(
state => state.app
const { hasInitialLoadCompleted } = useSelector(
(state: StateType) => state.app
);
const navTabsCollapsed = useSelector(getNavTabsCollapsed);
@ -73,4 +72,4 @@ export function SmartInbox(): JSX.Element {
renderStoriesTab={renderStoriesTab}
/>
);
}
});