fix: Cannot quit app when there is a dirty editor (#13164)#13173
Conversation
1482909 to
2b8ed54
Compare
|
The actual bug was the "cancel for the save untitled editor file location picker"-behavior was incorrectly triggered by "don't save" button as well. |
There was a problem hiding this comment.
Thanks for the PR, @emilhammarstedtst. The code appears to work fine, but I have a couple of suggestions.
packages/core/src/browser/dialogs.ts
Outdated
|
|
||
| // Asks the user to confirm whether they want to exit with or without saving the changes | ||
| export async function confirmExitWithOrWithoutSaving(captionsToSave: string[], performSave: () => Promise<void>): Promise<boolean> { | ||
| export async function confirmExitWithOrWithoutSaving(captionsToSave: string[], performSave?: () => Promise<void>): Promise<confirmExitWithOrWithoutSavingResult> { |
There was a problem hiding this comment.
Why would the parameter be optional? There is one usage in Theia code and it does pass something. If saving is a no-op, the user can always pass in a no-op.
packages/core/src/browser/dialogs.ts
Outdated
|
|
||
| } | ||
|
|
||
| export enum confirmExitWithOrWithoutSavingResult { |
There was a problem hiding this comment.
The convention is to return undefined from dialogs when the user does not make a choice (aka "the close box"). I don't think we should introduce a new type here, But just use boolean | undefined
There was a problem hiding this comment.
removed the return type.
packages/core/src/browser/dialogs.ts
Outdated
|
|
||
| } | ||
|
|
||
| export enum confirmExitWithOrWithoutSavingResult { |
There was a problem hiding this comment.
I wonder if we should not move this method over to common-frontend-contribution.ts. It only seems to be invoked from there and it seems to me we could simplify the code if we did.
There was a problem hiding this comment.
moved it. seems logical and collected.
Contributed by STMicroelectronics Signed-off-by: Emil HAMMARSTEDT <emil.hammarstedt@st.com>
2b8ed54 to
e900e2f
Compare
What it does
fixes issue #13164, TheiaBlueprint 1.44.0 cannot quit app when there is a dirty editor
How to test
=> the app quits.
Review checklist
Reminder for reviewers
Contributed by STMicroelectronics