Skip to content

Commit

Permalink
Merge pull request #20461 from emberjs/fix-cycle-crash
Browse files Browse the repository at this point in the history
Fix cyclic module crash
  • Loading branch information
ef4 committed May 17, 2023
2 parents 5de3020 + 7c31ada commit d5bf5f3
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions packages/@ember/engine/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import type Application from '@ember/application';
import type { BootEnvironment } from '@ember/-internals/glimmer';
import type { SimpleElement } from '@simple-dom/interface';

const CEngine = Engine;

export interface BootOptions {
isBrowser?: boolean;
shouldRender?: boolean;
Expand Down Expand Up @@ -202,17 +200,17 @@ class EngineInstance extends EmberObject.extend(RegistryProxyMixin, ContainerPro
@return {EngineInstance,Error}
*/
buildChildEngineInstance(name: string, options: EngineInstanceOptions = {}): EngineInstance {
let Engine = this.lookup(`engine:${name}`);
let ChildEngine = this.lookup(`engine:${name}`);

if (!Engine) {
if (!ChildEngine) {
throw new Error(
`You attempted to mount the engine '${name}', but it is not registered with its parent.`
);
}

assert('expected an Engine', Engine instanceof CEngine);
assert('expected an Engine', ChildEngine instanceof Engine);

let engineInstance = Engine.buildInstance(options);
let engineInstance = ChildEngine.buildInstance(options);

setEngineParent(engineInstance, this);

Expand Down

0 comments on commit d5bf5f3

Please sign in to comment.