Skip to content

Commit

Permalink
ui: unload auth method when navigating away from form (#18651)
Browse files Browse the repository at this point in the history
* unload record instead of rollback

* unload record instead of rollback

* add changelog

* add rollback attrs back if record is not new
  • Loading branch information
hellobontempo committed Jan 12, 2023
1 parent 418082d commit 9752352
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelog/18651.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
ui: cleanup unsaved auth method ember data record when navigating away from mount backend form
```
5 changes: 4 additions & 1 deletion ui/app/components/mount-backend-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export default class MountBackendForm extends Component {
willDestroy() {
// if unsaved, we want to unload so it doesn't show up in the auth mount list
super.willDestroy(...arguments);
this.args.mountModel.rollbackAttributes();
if (this.args.mountModel) {
const method = this.args.mountModel.isNew ? 'unloadRecord' : 'rollbackAttributes';
this.args.mountModel[method]();
}
}

checkPathChange(type) {
Expand Down

0 comments on commit 9752352

Please sign in to comment.