Skip to content

Commit 008b94c

Browse files
committed
Add onAbort to DevSessionUI
1 parent 34a6555 commit 008b94c

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

packages/app/src/cli/services/dev/ui/components/DevSessionUI.test.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ const initialStatus: DevSessionStatus = {
2626
graphiqlURL: 'https://graphiql.shopify.com',
2727
}
2828

29+
const onAbort = vi.fn()
30+
2931
describe('DevSessionUI', () => {
3032
beforeEach(() => {
3133
devSessionStatusManager = new DevSessionStatusManager()
@@ -76,6 +78,7 @@ describe('DevSessionUI', () => {
7678
processes={[backendProcess, frontendProcess]}
7779
abortController={new AbortController()}
7880
devSessionStatusManager={devSessionStatusManager}
81+
onAbort={onAbort}
7982
/>,
8083
)
8184

@@ -111,6 +114,7 @@ describe('DevSessionUI', () => {
111114
processes={[]}
112115
abortController={new AbortController()}
113116
devSessionStatusManager={devSessionStatusManager}
117+
onAbort={onAbort}
114118
/>,
115119
)
116120

@@ -130,6 +134,7 @@ describe('DevSessionUI', () => {
130134
processes={[]}
131135
abortController={new AbortController()}
132136
devSessionStatusManager={devSessionStatusManager}
137+
onAbort={onAbort}
133138
/>,
134139
)
135140

@@ -153,6 +158,7 @@ describe('DevSessionUI', () => {
153158
processes={[]}
154159
abortController={abortController}
155160
devSessionStatusManager={devSessionStatusManager}
161+
onAbort={onAbort}
156162
/>,
157163
)
158164

@@ -179,6 +185,7 @@ describe('DevSessionUI', () => {
179185
processes={[]}
180186
abortController={abortController}
181187
devSessionStatusManager={devSessionStatusManager}
188+
onAbort={onAbort}
182189
/>,
183190
)
184191

@@ -220,6 +227,7 @@ describe('DevSessionUI', () => {
220227
processes={[backendProcess]}
221228
abortController={abortController}
222229
devSessionStatusManager={devSessionStatusManager}
230+
onAbort={onAbort}
223231
/>,
224232
)
225233

@@ -265,6 +273,7 @@ describe('DevSessionUI', () => {
265273
processes={[]}
266274
abortController={new AbortController()}
267275
devSessionStatusManager={devSessionStatusManager}
276+
onAbort={onAbort}
268277
/>,
269278
)
270279

@@ -297,6 +306,7 @@ describe('DevSessionUI', () => {
297306
processes={[]}
298307
abortController={new AbortController()}
299308
devSessionStatusManager={devSessionStatusManager}
309+
onAbort={onAbort}
300310
/>,
301311
)
302312

@@ -338,6 +348,7 @@ describe('DevSessionUI', () => {
338348
processes={[errorProcess]}
339349
abortController={abortController}
340350
devSessionStatusManager={devSessionStatusManager}
351+
onAbort={onAbort}
341352
/>,
342353
)
343354

packages/app/src/cli/services/dev/ui/components/DevSessionUI.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ interface DevSesionUIProps {
1818
processes: OutputProcess[]
1919
abortController: AbortController
2020
devSessionStatusManager: DevSessionStatusManager
21+
onAbort: () => Promise<void>
2122
}
2223

23-
const DevSessionUI: FunctionComponent<DevSesionUIProps> = ({abortController, processes, devSessionStatusManager}) => {
24+
const DevSessionUI: FunctionComponent<DevSesionUIProps> = ({
25+
abortController,
26+
processes,
27+
devSessionStatusManager,
28+
onAbort,
29+
}) => {
2430
const {isRawModeSupported: canUseShortcuts} = useStdin()
2531

2632
const [isShuttingDownMessage, setIsShuttingDownMessage] = useState<string | undefined>(undefined)
@@ -39,6 +45,7 @@ const DevSessionUI: FunctionComponent<DevSesionUIProps> = ({abortController, pro
3945
})
4046
}, 2000)
4147
}
48+
await onAbort()
4249
})
4350

4451
const errorHandledProcesses = useMemo(() => {

0 commit comments

Comments
 (0)