ui: unload auth method when navigating away from form (#18651)

* unload record instead of rollback

* unload record instead of rollback

* add changelog

* add rollback attrs back if record is not new
This commit is contained in:
claire bontempo 2023-01-12 13:03:22 -08:00 committed by GitHub
parent 03b23a7970
commit 0f0b48eda4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

3
changelog/18651.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:bug
ui: cleanup unsaved auth method ember data record when navigating away from mount backend form
```

View File

@ -33,7 +33,10 @@ export default class MountBackendForm extends Component {
willDestroy() { willDestroy() {
// if unsaved, we want to unload so it doesn't show up in the auth mount list // if unsaved, we want to unload so it doesn't show up in the auth mount list
super.willDestroy(...arguments); 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) { checkPathChange(type) {