Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX LTS] Fix cyclic module crash #20461

Merged
merged 1 commit into from
May 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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