You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/renderer/features/task-detail/hooks/useTaskCreation.ts
+14-3Lines changed: 14 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -48,14 +48,23 @@ export function useTaskCreation({
48
48
49
49
constcanSubmit=
50
50
!!editor&&
51
-
!!isAuthenticated&&
51
+
isAuthenticated&&
52
52
!!client&&
53
53
!!selectedDirectory&&
54
54
!isCreatingTask&&
55
55
!editor.isEmpty;
56
56
57
57
consthandleSubmit=useCallback(()=>{
58
-
if(!canSubmit||!editor){
58
+
// TRICKY: This needs to be redefined in the callback due to a weird issue where the callback uses a stale version of canSubmit, even if its a dependency
59
+
constcanSubmit=
60
+
!!editor&&
61
+
isAuthenticated&&
62
+
!!client&&
63
+
!!selectedDirectory&&
64
+
!isCreatingTask&&
65
+
!editor.isEmpty;
66
+
67
+
if(!canSubmit){
59
68
return;
60
69
}
61
70
@@ -102,7 +111,6 @@ export function useTaskCreation({
102
111
},
103
112
);
104
113
},[
105
-
canSubmit,
106
114
editor,
107
115
selectedDirectory,
108
116
detectedRepo,
@@ -115,6 +123,9 @@ export function useTaskCreation({
0 commit comments