File tree 3 files changed +13
-66
lines changed
components/Dashboard/DeploymentBanner
xServices/deploymentStats
3 files changed +13
-66
lines changed Original file line number Diff line number Diff line change @@ -13,3 +13,10 @@ export const deploymentDAUs = () => {
13
13
queryFn : ( ) => API . getDeploymentDAUs ( ) ,
14
14
} ;
15
15
} ;
16
+
17
+ export const deploymentStats = ( ) => {
18
+ return {
19
+ queryKey : [ "deployment" , "stats" ] ,
20
+ queryFn : ( ) => API . getDeploymentStats ( ) ,
21
+ } ;
22
+ } ;
Original file line number Diff line number Diff line change 1
- import { useMachine } from "@xstate/react" ;
2
1
import { usePermissions } from "hooks/usePermissions" ;
3
2
import { DeploymentBannerView } from "./DeploymentBannerView" ;
4
- import { deploymentStatsMachine } from "xServices/deploymentStats/deploymentStatsMachine" ;
3
+ import { useQuery } from "@tanstack/react-query" ;
4
+ import { deploymentStats } from "api/queries/deployment" ;
5
5
6
6
export const DeploymentBanner : React . FC = ( ) => {
7
7
const permissions = usePermissions ( ) ;
8
- const [ state , sendEvent ] = useMachine ( deploymentStatsMachine ) ;
8
+ const deploymentStatsQuery = useQuery ( deploymentStats ( ) ) ;
9
9
10
- if ( ! permissions . viewDeploymentValues || ! state . context . deploymentStats ) {
10
+ if ( ! permissions . viewDeploymentValues || ! deploymentStatsQuery . data ) {
11
11
return null ;
12
12
}
13
13
14
14
return (
15
15
< DeploymentBannerView
16
- stats = { state . context . deploymentStats }
17
- fetchStats = { ( ) => sendEvent ( "RELOAD" ) }
16
+ stats = { deploymentStatsQuery . data }
17
+ fetchStats = { ( ) => deploymentStatsQuery . refetch ( ) }
18
18
/>
19
19
) ;
20
20
} ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments