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

Fix case where autoRun is false but no other addon set content into the {{content-for 'app-boot'}} #710

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/compat/src/v1-appboot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,19 @@ export class WriteV1AppBoot extends Plugin {

export class ReadV1AppBoot extends Plugin {
private appBoot: string | undefined;
private hasBuilt = false;
constructor(appBootTree: Node) {
super([appBootTree], {
persistentOutput: true,
});
}
build() {
this.appBoot = readFileSync(join(this.inputPaths[0], `config/app-boot.js`), 'utf8');
this.hasBuilt = true;
}

readAppBoot() {
if (!this.appBoot) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, the prior guard had issues because in cases where no addon emits {{content-for 'app-boot'}} content the value will be '', which is going to evaluate to falsey.

if (!this.hasBuilt) {
throw new Error(`AppBoot not available until after the build`);
}
return this.appBoot;
Expand Down