🐛 Fixed unexpected "unsaved changes" modals when accessing screens

no issue

We weren't correctly clearing state for the "display modal" booleans when leaving screens. This meant that it was possible to end up in a state where where every time you access a screen you get the unsaved changes modal
This commit is contained in:
Kevin Ansfield 2019-12-13 17:09:06 +00:00
parent 4c9fc47df8
commit a6c005e5be
5 changed files with 20 additions and 2 deletions

View File

@ -668,6 +668,7 @@ export default Controller.extend({
this.set('hasDirtyAttributes', false);
this.set('shouldFocusEditor', false);
this.set('leaveEditorTransition', null);
this.set('showLeaveEditorModal', false);
this.set('infoMessage', null);
this.set('wordCount', null);

View File

@ -16,6 +16,12 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
return this.settings.reload();
},
deactivate() {
this._super(...arguments);
this.controller.set('leaveSettingsTransition', null);
this.controller.set('showLeaveSettingsModal', false);
},
actions: {
save() {
this.controller.send('save');

View File

@ -21,12 +21,16 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
},
setupController(controller) {
// reset the leave setting transition
controller.set('leaveSettingsTransition', null);
controller.set('themes', this.store.peekAll('theme'));
this.controller.send('reset');
},
deactivate() {
this._super(...arguments);
this.controller.set('leaveSettingsTransition', null);
this.controller.set('showLeaveSettingsModal', false);
},
actions: {
save() {
// since shortcuts are run on the route, we have to signal to the components

View File

@ -23,6 +23,7 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
setupController(controller, models) {
// reset the leave setting transition
controller.set('showLeaveSettingsModal', false);
controller.set('leaveSettingsTransition', null);
controller.set('availableTimezones', models.availableTimezones);
},

View File

@ -28,6 +28,12 @@ export default AuthenticatedRoute.extend(CurrentUserSettings, {
.integrationModelHook('id', params.integration_id, this, transition);
},
deactivate() {
this._super(...arguments);
this.controller.set('leaveScreenTransition', null);
this.controller.set('showUnsavedChangesModal', false);
},
actions: {
save() {
this.controller.send('save');