Skip to content

Commit

Permalink
Exclude estimated deposits from useDeposits data hook by default (#7605)
Browse files Browse the repository at this point in the history
Co-authored-by: Rua Haszard <[email protected]>
Co-authored-by: Eric Jinks <[email protected]>
  • Loading branch information
3 people authored Nov 7, 2023
1 parent e56b4e5 commit 831e012
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions changelog/7604-no-estimated-deposits-on-deposits-detail-page
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: major
Type: update

Exclude estimated deposits from the deposits list screen
22 changes: 18 additions & 4 deletions client/data/deposits/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,14 @@ export const useDeposits = ( {
date_between: dateBetween,
status_is: statusIs,
status_is_not: statusIsNot,
}: Query ): CachedDeposits =>
useSelect(
}: Query ): CachedDeposits => {
// Temporarily default to excluding estimated deposits.
// Client components can (temporarily) opt-in by passing `status_is=estimated`.
// When we remove estimated deposits from server / APIs we can remove this default.
if ( ! statusIsNot && statusIs !== 'estimated' ) {
statusIsNot = 'estimated';
}
return useSelect(
( select ) => {
const {
getDeposits,
Expand Down Expand Up @@ -176,6 +182,7 @@ export const useDeposits = ( {
statusIsNot,
]
);
};

export const useDepositsSummary = ( {
match,
Expand All @@ -185,8 +192,14 @@ export const useDepositsSummary = ( {
date_between: dateBetween,
status_is: statusIs,
status_is_not: statusIsNot,
}: Query ): DepositsSummaryCache =>
useSelect(
}: Query ): DepositsSummaryCache => {
// Temporarily default to excluding estimated deposits.
// Client components can (temporarily) opt-in by passing `status_is=estimated`.
// When we remove estimated deposits from server / APIs we can remove this default.
if ( ! statusIsNot && statusIs !== 'estimated' ) {
statusIsNot = 'estimated';
}
return useSelect(
( select ) => {
const { getDepositsSummary, isResolving } = select( STORE_NAME );

Expand Down Expand Up @@ -215,6 +228,7 @@ export const useDepositsSummary = ( {
statusIsNot,
]
);
};

export const useInstantDeposit = (
transactionIds: string[]
Expand Down

0 comments on commit 831e012

Please sign in to comment.