Skip to content

Commit 3531bab

Browse files
author
Tyler Deemer
committed
Do not call AfterUserAction if not necessary
1 parent 64627a2 commit 3531bab

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/commands/studio.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,14 @@ class StudioActions {
277277
(actionToProcess) =>
278278
actionToProcess &&
279279
!afterUserAction &&
280-
this.processUserAction(actionToProcess).then((answer) =>
281-
answer && (answer.msg || answer.msg === "")
282-
? this.userAction(action, true, answer.answer, answer.msg, type)
283-
: this.userAction(action, true, answer, "", type)
284-
)
280+
this.processUserAction(actionToProcess).then((answer) => {
281+
// call AfterUserAction only if there is a valid answer
282+
if (answer) {
283+
answer.msg || answer.msg === ""
284+
? this.userAction(action, true, answer.answer, answer.msg, type)
285+
: this.userAction(action, true, answer, "", type);
286+
}
287+
})
285288
)
286289
.then(() => resolve())
287290
.catch((err) => {

0 commit comments

Comments
 (0)