Skip to content

Commit

Permalink
fix: inlined components weren't preloaded on first load
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobrosenberg committed Jul 8, 2023
1 parent 41d01af commit a9a57cc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/runtime/Instance/RNodeRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ export class RNodeRuntime extends RNode {

async loadModule() {
if (!this.module && this.asyncModule) {
this.module = await this.asyncModule()
let childPromises = []
// if bundling or SSR, load children too
if (this.meta.bundle || typeof window === 'undefined')
childPromises = this.children.map(c => c.loadModule())
;[this.module] = await Promise.all([this.asyncModule(), ...childPromises])
}
return this.module
}
Expand Down

0 comments on commit a9a57cc

Please sign in to comment.