Skip to content

Commit

Permalink
Fix fastboot ReferenceError: document is not defined (#834)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkszepp authored Mar 13, 2024
1 parent 54aadc8 commit 233b609
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ export default class BasicDropdownWormholeComponent extends Component<BasicDropd
};

if (config.environment === 'test') {
// document doesn't exists in fastboot apps, for this reason we need this check
if (!document) {
return '';
}
const rootElement = config['APP']?.rootElement;
return document.querySelector(rootElement)?.id ?? '';
}
Expand Down
4 changes: 4 additions & 0 deletions ember-basic-dropdown/src/components/basic-dropdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ export default class BasicDropdown extends Component<BasicDropdownSignature> {
};

if (config.environment === 'test') {
// document doesn't exists in fastboot apps, for this reason we need this check
if (!document) {
return 'ember-basic-dropdown-wormhole';
}
const rootElement = config['APP']?.rootElement;
return (
document.querySelector(rootElement)?.id ??
Expand Down

0 comments on commit 233b609

Please sign in to comment.