File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
site/src/pages/WorkspacesPage Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -78,13 +78,14 @@ export function useBatchActions(
78
78
} ,
79
79
} ) ;
80
80
81
- // We have to explicitly make the mutation functions for the
82
- // favorite/unfavorite functionality be async and then void out the
83
- // Promise.all result because otherwise the return type becomes a void
84
- // array, which doesn't ever make sense with TypeScript's type system
81
+ // Not a great idea to return the promises from the Promise.all calls below
82
+ // because that then gives you a void array, which doesn't make sense with
83
+ // TypeScript's type system. Best to await them, and then have the wrapper
84
+ // mutation function return its own void promise
85
+
85
86
const favoriteAllMutation = useMutation ( {
86
87
mutationFn : async ( workspaces : readonly Workspace [ ] ) => {
87
- void Promise . all (
88
+ await Promise . all (
88
89
workspaces
89
90
. filter ( ( w ) => ! w . favorite )
90
91
. map ( ( w ) => API . putFavoriteWorkspace ( w . id ) ) ,
@@ -98,7 +99,7 @@ export function useBatchActions(
98
99
99
100
const unfavoriteAllMutation = useMutation ( {
100
101
mutationFn : async ( workspaces : readonly Workspace [ ] ) => {
101
- void Promise . all (
102
+ await Promise . all (
102
103
workspaces
103
104
. filter ( ( w ) => w . favorite )
104
105
. map ( ( w ) => API . deleteFavoriteWorkspace ( w . id ) ) ,
You can’t perform that action at this time.
0 commit comments