Skip to content

Commit

Permalink
hotfix: even looser component loading
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Apr 22, 2024
1 parent 9ece2f1 commit bba2a17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "myrelay.site",
"type": "module",
"version": "0.2.7",
"version": "0.2.8",
"main": "index.js",
"repository": "[email protected]:sandwichfarm/myrelay.site.git",
"author": "dskvr <[email protected]>",
Expand Down
15 changes: 7 additions & 8 deletions src/lib/core/MRPBlockLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class BlockLoader extends MRPData {
async init(){
if(this.isPending) return
this.begin()
await this.loadAllComponents().catch(BlockLoader.errorHandler)
this.loadAllComponents().catch(BlockLoader.errorHandler)
}

async loadComponentOptions(key: string): Promise<ComponentOptions> {
Expand Down Expand Up @@ -64,16 +64,16 @@ export class BlockLoader extends MRPData {
}

async loadAllComponents(){
await this.loadUniqueComponents().catch(BlockLoader.errorHandler)
await this.loadRepeatableComponents().catch(BlockLoader.errorHandler)
await this.loadRemoteComponents().catch(BlockLoader.errorHandler)
this.loadUniqueComponents().catch(BlockLoader.errorHandler)
this.loadRepeatableComponents().catch(BlockLoader.errorHandler)
// this.loadRemoteComponents().catch(BlockLoader.errorHandler)
}

async loadUniqueComponents(){
for (let key in this.config.event.blocks){
if(this.isRepeatable(key)) continue
if(this._components?.[key] !== undefined) continue;
if(this.config.event.blocks[key].custom === true) continue;
await this.loadUniqueComponent(key).catch(BlockLoader.errorHandler)
this.loadUniqueComponent(key).catch(BlockLoader.errorHandler)
}
}

Expand Down Expand Up @@ -129,9 +129,8 @@ export class BlockLoader extends MRPData {

private async loadUniqueComponent(key: string): Promise<NodeModule | undefined> {
const block = this.config.event.blocks?.[key]
const isUnique = !this.isRepeatable(key)
let $component;
if(block && isUnique){
if(block){
$component = await import(`../components/blocks/unique/${key}/${key}.svelte`).catch(BlockLoader.errorHandler)
this._components[key] = $component?.default? $component.default: $component
}
Expand Down

0 comments on commit bba2a17

Please sign in to comment.