Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: show discard window only for drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
tilmx authored and marionebl committed Sep 20, 2018
1 parent d294770 commit 66e7c54
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/electron/create-file-message-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function createFileMessageHandler(
switch (message.type) {
case Message.MessageType.CreateNewFileRequest: {
// Prompt the user to save if there has been a project previously
if (ctx.project) {
if (ctx.project && ctx.project.getDraft()) {
const discardResult = await showDiscardDialog(ctx.project);

if (discardResult === DiscardDialogResult.Save) {
Expand All @@ -46,6 +46,10 @@ export async function createFileMessageHandler(
return showError(saveResult.payload.result.error);
}
}

if (discardResult === DiscardDialogResult.Cancel) {
return;
}
}

const draftPath = Path.join(ctx.appPath, `${uuid.v4()}.alva`);
Expand Down

0 comments on commit 66e7c54

Please sign in to comment.