1
1
import { emptyTransition , Transition } from '@atlassianlabs/jira-pi-common-models' ;
2
2
import { Box , Button , CircularProgress , Typography } from '@material-ui/core' ;
3
- import React , { useCallback , useEffect , useState } from 'react' ;
3
+ import React , { useCallback , useContext , useEffect , useState } from 'react' ;
4
4
import { AnalyticsView } from 'src/analyticsTypes' ;
5
5
6
6
import { StartWorkActionType } from '../../../../lib/ipc/fromUI/startWork' ;
7
7
import { RepoData } from '../../../../lib/ipc/toUI/startWork' ;
8
8
import { Branch } from '../../../../typings/git' ;
9
9
import { AtlascodeErrorBoundary } from '../../common/ErrorBoundary' ;
10
+ import { ErrorControllerContext } from '../../common/errorController' ;
11
+ import { ErrorDisplay } from '../../common/ErrorDisplay' ;
10
12
import { StartWorkControllerContext , useStartWorkController } from '../startWorkController' ;
11
13
import {
12
14
CreateBranchSection ,
@@ -19,6 +21,7 @@ import { generateBranchName, getDefaultSourceBranch } from './utils/branchUtils'
19
21
20
22
const StartWorkPageV3 : React . FunctionComponent = ( ) => {
21
23
const [ state , controller ] = useStartWorkController ( ) ;
24
+ const errorController = useContext ( ErrorControllerContext ) ;
22
25
const [ pushBranchEnabled , setPushBranchEnabled ] = useState ( true ) ;
23
26
const [ localBranch , setLocalBranch ] = useState ( '' ) ;
24
27
const [ sourceBranch , setSourceBranch ] = useState < Branch > ( { type : 0 , name : '' } ) ;
@@ -141,18 +144,20 @@ const StartWorkPageV3: React.FunctionComponent = () => {
141
144
setSnackbarOpen ( true ) ;
142
145
} catch ( error ) {
143
146
console . error ( 'Error creating branch:' , error ) ;
147
+ errorController . showError ( error ) ;
144
148
setSubmitState ( 'initial' ) ;
145
149
}
146
150
} , [
151
+ selectedRepository ,
147
152
controller ,
148
153
transitionIssueEnabled ,
149
154
selectedTransition ,
150
155
branchSetupEnabled ,
151
- pushBranchEnabled ,
152
- localBranch ,
153
156
sourceBranch ,
154
- selectedRepository ,
157
+ localBranch ,
155
158
upstream ,
159
+ pushBranchEnabled ,
160
+ errorController ,
156
161
] ) ;
157
162
158
163
const formState = {
@@ -200,6 +205,10 @@ const StartWorkPageV3: React.FunctionComponent = () => {
200
205
201
206
{ submitState === 'submit-success' && < SuccessAlert submitResponse = { submitResponse } /> }
202
207
208
+ < Box marginBottom = { 2 } >
209
+ < ErrorDisplay />
210
+ </ Box >
211
+
203
212
< TaskInfoSection state = { state } controller = { controller } />
204
213
< CreateBranchSection
205
214
state = { state }
0 commit comments