Skip to content

Commit 69f07aa

Browse files
committed
fix: simplify choice builder close
1 parent 0e25416 commit 69f07aa

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

src/gui/ChoiceBuilder/choiceBuilder.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@ import { promptRenameChoice } from "../choiceRename";
1111

1212
export abstract class ChoiceBuilder extends Modal {
1313
private resolvePromise: (input: IChoice) => void;
14-
private rejectPromise: (reason?: unknown) => void;
15-
private input: IChoice;
1614
public waitForClose: Promise<IChoice>;
1715
abstract choice: IChoice;
18-
private didSubmit = false;
1916
protected svelteElements: SvelteComponent[] = [];
2017

2118
protected constructor(app: App) {
2219
super(app);
2320

24-
this.waitForClose = new Promise<IChoice>((resolve, reject) => {
21+
this.waitForClose = new Promise<IChoice>((resolve) => {
2522
this.resolvePromise = resolve;
26-
this.rejectPromise = reject;
2723
});
2824

2925
this.containerEl.addClass("quickAddModal");
@@ -208,12 +204,9 @@ export abstract class ChoiceBuilder extends Modal {
208204

209205
onClose() {
210206
super.onClose();
211-
this.resolvePromise(this.choice);
212207
this.svelteElements.forEach((el) => {
213208
if (el && el.$destroy) el.$destroy();
214209
});
215-
216-
if (!this.didSubmit) this.rejectPromise("No answer given.");
217-
else this.resolvePromise(this.input);
210+
this.resolvePromise(this.choice);
218211
}
219212
}

0 commit comments

Comments
 (0)