Skip to content

Commit

Permalink
#464411- FIx loaderStopInit
Browse files Browse the repository at this point in the history
  • Loading branch information
infloent committed May 28, 2024
1 parent d6d46ca commit b9bd59e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion blocks/footer/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default class Footer extends ComponentBase {
static loaderConfig = {
...ComponentBase.loaderConfig,
loaderStopInit() {
return metaFragment === false;
return metaFooter === false;
},
};

Expand Down
2 changes: 1 addition & 1 deletion head.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

const headerMeta = document.querySelector('meta[name="header"]');
const url = headerMeta?.content.trim();
if (url.toLowerCase() !== 'false') {
if (url?.toLowerCase() !== 'false') {
const link = document.createElement('link');
link.setAttribute('rel', 'preload');
link.setAttribute('as', 'fetch');
Expand Down
4 changes: 2 additions & 2 deletions scripts/component-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export default class ComponentLoader {
const { loaded, error } = await this.loadAndDefine();
if (!loaded) throw error;
this.setHandlerType();
if (await this.Handler?.loaderStopInit?.()) return [];
this.loaderConfig = deepMerge({}, this.Handler.loaderConfig, this.loaderConfig);
if (await this.loaderConfig?.loaderStopInit?.()) return [];
if (!this.targets?.length) return [];

this.setTargets();
Expand Down Expand Up @@ -140,7 +141,6 @@ export default class ComponentLoader {
}

setTargets() {
this.loaderConfig = deepMerge({}, this.Handler.loaderConfig, this.loaderConfig);
const { targetsSelectorsPrefix, targetsSelectors, targetsSelectorsLimit, targetsAsContainers, selectorTest } =
this.loaderConfig;
const selector = `${targetsSelectorsPrefix || ''} ${targetsSelectors}`;
Expand Down

0 comments on commit b9bd59e

Please sign in to comment.