@@ -32,7 +32,6 @@ export interface WorkspaceContext {
32
32
// Builds
33
33
builds ?: TypesGen . WorkspaceBuild [ ]
34
34
getBuildsError ?: Error | unknown
35
- loadMoreBuildsError ?: Error | unknown
36
35
// error creating a new WorkspaceBuild
37
36
buildError ?: Error | unknown
38
37
cancellationMessage ?: Types . Message
@@ -53,7 +52,6 @@ export type WorkspaceEvent =
53
52
| { type : "CANCEL_DELETE" }
54
53
| { type : "UPDATE" }
55
54
| { type : "CANCEL" }
56
- | { type : "LOAD_MORE_BUILDS" }
57
55
| { type : "CHECK_REFRESH_TIMELINE" ; data : TypesGen . ServerSentEvent [ "data" ] }
58
56
| { type : "REFRESH_TIMELINE" }
59
57
| { type : "EVENT_SOURCE_ERROR" ; error : Error | unknown }
@@ -118,9 +116,6 @@ export const workspaceMachine = createMachine(
118
116
getBuilds : {
119
117
data : TypesGen . WorkspaceBuild [ ]
120
118
}
121
- loadMoreBuilds : {
122
- data : TypesGen . WorkspaceBuild [ ]
123
- }
124
119
checkPermissions : {
125
120
data : TypesGen . UserAuthorizationResponse
126
121
}
@@ -396,33 +391,11 @@ export const workspaceMachine = createMachine(
396
391
states : {
397
392
idle : {
398
393
on : {
399
- LOAD_MORE_BUILDS : {
400
- cond : "hasMoreBuilds" ,
401
- target : "loadingMoreBuilds" ,
402
- } ,
403
394
REFRESH_TIMELINE : {
404
395
target : "#workspaceState.ready.timeline.gettingBuilds" ,
405
396
} ,
406
397
} ,
407
398
} ,
408
- loadingMoreBuilds : {
409
- entry : "clearLoadMoreBuildsError" ,
410
- invoke : {
411
- src : "loadMoreBuilds" ,
412
- onDone : [
413
- {
414
- actions : "assignNewBuilds" ,
415
- target : "idle" ,
416
- } ,
417
- ] ,
418
- onError : [
419
- {
420
- actions : "assignLoadMoreBuildsError" ,
421
- target : "idle" ,
422
- } ,
423
- ] ,
424
- } ,
425
- } ,
426
399
} ,
427
400
} ,
428
401
} ,
@@ -530,24 +503,6 @@ export const workspaceMachine = createMachine(
530
503
clearGetBuildsError : assign ( {
531
504
getBuildsError : ( _ ) => undefined ,
532
505
} ) ,
533
- assignNewBuilds : assign ( {
534
- builds : ( context , event ) => {
535
- const oldBuilds = context . builds
536
-
537
- if ( ! oldBuilds ) {
538
- // This state is theoretically impossible, but helps TS
539
- throw new Error ( "workspaceXService: failed to load workspace builds" )
540
- }
541
-
542
- return [ ...oldBuilds , ...event . data ]
543
- } ,
544
- } ) ,
545
- assignLoadMoreBuildsError : assign ( {
546
- loadMoreBuildsError : ( _ , event ) => event . data ,
547
- } ) ,
548
- clearLoadMoreBuildsError : assign ( {
549
- loadMoreBuildsError : ( _ ) => undefined ,
550
- } ) ,
551
506
refreshTimeline : pure ( ( context , event ) => {
552
507
// No need to refresh the timeline if it is not loaded
553
508
if ( ! context . builds ) {
@@ -567,9 +522,6 @@ export const workspaceMachine = createMachine(
567
522
}
568
523
} ) ,
569
524
} ,
570
- guards : {
571
- hasMoreBuilds : ( _ ) => false ,
572
- } ,
573
525
services : {
574
526
getWorkspace : async ( _ , event ) => {
575
527
return await API . getWorkspaceByOwnerAndName ( event . username , event . workspaceName , {
@@ -651,13 +603,6 @@ export const workspaceMachine = createMachine(
651
603
throw Error ( "Cannot get builds without id" )
652
604
}
653
605
} ,
654
- loadMoreBuilds : async ( context ) => {
655
- if ( context . workspace ) {
656
- return await API . getWorkspaceBuilds ( context . workspace . id )
657
- } else {
658
- throw Error ( "Cannot load more builds without id" )
659
- }
660
- } ,
661
606
checkPermissions : async ( context ) => {
662
607
if ( context . workspace && context . userId ) {
663
608
return await API . checkUserPermissions ( context . userId , {
0 commit comments