@@ -4,13 +4,13 @@ import { shallowEqual } from "react-redux";
44import { PageHeader , Select } from 'antd'
55
66import { useAppSelector , useAppDispatch } from '../redux/hooks'
7- import { repoHomeSlice , init , fetchEnvs , fetchDeployments , perPage } from '../redux/repoHome'
7+ import { repoHomeSlice as slice , init , fetchEnvs , fetchDeployments , perPage } from '../redux/repoHome'
8+ import { subscribeDeploymentEvent } from "../apis"
89
910import ActivityLogs from '../components/ActivityLogs'
1011import Spin from '../components/Spin'
1112import Pagination from '../components/Pagination'
1213
13- const { actions } = repoHomeSlice
1414const { Option } = Select
1515
1616interface Params {
@@ -35,23 +35,31 @@ export default function RepoHome(): JSX.Element {
3535 await dispatch ( fetchDeployments ( ) )
3636 }
3737 f ( )
38+
39+ const de = subscribeDeploymentEvent ( ( d ) => {
40+ dispatch ( slice . actions . handleDeploymentEvent ( d ) )
41+ } )
42+
43+ return ( ) => {
44+ de . close ( )
45+ }
3846 // eslint-disable-next-line
3947 } , [ dispatch ] )
4048
4149 const isLast = deployments . length < perPage
4250
4351 const onChangeEnv = ( env : string ) => {
44- dispatch ( actions . setEnv ( env ) )
52+ dispatch ( slice . actions . setEnv ( env ) )
4553 dispatch ( fetchDeployments ( ) )
4654 }
4755
4856 const onClickPrev = ( ) => {
49- dispatch ( actions . decreasePage ( ) )
57+ dispatch ( slice . actions . decreasePage ( ) )
5058 dispatch ( fetchDeployments ( ) )
5159 }
5260
5361 const onClickNext = ( ) => {
54- dispatch ( actions . increasePage ( ) )
62+ dispatch ( slice . actions . increasePage ( ) )
5563 dispatch ( fetchDeployments ( ) )
5664 }
5765
0 commit comments