Always use static/cached selectors in useSelector
This commit is contained in:
parent
d85a1d5074
commit
1e275a917c
13 changed files with 105 additions and 70 deletions
17
ts/state/selectors/inbox.ts
Normal file
17
ts/state/selectors/inbox.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2024 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { createSelector } from 'reselect';
|
||||
import type { StateType } from '../reducer';
|
||||
|
||||
const getInboxState = (state: StateType) => state.inbox;
|
||||
|
||||
export const getInboxEnvelopeTimestamp = createSelector(
|
||||
getInboxState,
|
||||
({ envelopeTimestamp }) => envelopeTimestamp
|
||||
);
|
||||
|
||||
export const getInboxFirstEnvelopeTimestamp = createSelector(
|
||||
getInboxState,
|
||||
({ firstEnvelopeTimestamp }) => firstEnvelopeTimestamp
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue