Skip to content

Commit

Permalink
fix(owner): unregister calls container.reset
Browse files Browse the repository at this point in the history
  • Loading branch information
buschtoens committed Apr 30, 2022
1 parent 7d0aab9 commit 5341621
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions addon-test-support/@ember/test-helpers/-internal/build-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,25 @@ const ContainerProxyMixin = (Ember as any)._ContainerProxyMixin;

const Owner = EmberObject.extend(RegistryProxyMixin, ContainerProxyMixin, {
_emberTestHelpersMockOwner: true,

/**
* Unregister a factory and its instance.
*
* Overrides `RegistryProxy#unregister` in order to clear any cached instances
* of the unregistered factory.
*
* @do-not-use-redundant-method-tag unregister
* @param {string} fullName Name of the factory to unregister.
*
* @see {@link https://github.com/emberjs/ember.js/pull/12680}
* @see {@link https://github.com/emberjs/ember.js/blob/v4.5.0-alpha.5/packages/%40ember/engine/instance.ts#L152-L167}
*/
unregister(fullName: string) {
this.__container__.reset(fullName);

// We overwrote this method from RegistryProxyMixin.
this.__registry__.unregister(fullName);
},
});

/**
Expand Down

0 comments on commit 5341621

Please sign in to comment.