diff --git a/changelog/18651.txt b/changelog/18651.txt new file mode 100644 index 000000000..9fc7ff8e4 --- /dev/null +++ b/changelog/18651.txt @@ -0,0 +1,3 @@ +```release-note:bug +ui: cleanup unsaved auth method ember data record when navigating away from mount backend form +``` \ No newline at end of file diff --git a/ui/app/components/mount-backend-form.js b/ui/app/components/mount-backend-form.js index fafd5a4a6..4cb9c33d5 100644 --- a/ui/app/components/mount-backend-form.js +++ b/ui/app/components/mount-backend-form.js @@ -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) {