Skip to content

Commit

Permalink
fix: eagerly initialise dependencies cache (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Mar 22, 2023
1 parent fe3a42a commit 7b72ba2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function getModuleDependencies (id: string, rendererContext: RendererCont
return rendererContext._dependencies[id]
}

const dependencies: ModuleDependencies = {
const dependencies: ModuleDependencies = rendererContext._dependencies[id] = {
scripts: {},
styles: {},
preload: {},
Expand All @@ -89,7 +89,6 @@ export function getModuleDependencies (id: string, rendererContext: RendererCont
const meta = rendererContext.manifest[id]

if (!meta) {
rendererContext._dependencies[id] = dependencies
return dependencies
}

Expand Down Expand Up @@ -122,7 +121,6 @@ export function getModuleDependencies (id: string, rendererContext: RendererCont
}
dependencies.preload = filteredPreload

rendererContext._dependencies[id] = dependencies
return dependencies
}

Expand Down Expand Up @@ -255,7 +253,7 @@ export function createRenderer (createApp: any, renderOptions: RenderOptions & {
const app = await _createApp(ssrContext)
const html = await renderOptions.renderToString(app, ssrContext)

const wrap = <T extends RenderFunction>(fn: T) => () => fn(ssrContext, rendererContext) as ReturnType<T>
const wrap = <T extends RenderFunction> (fn: T) => () => fn(ssrContext, rendererContext) as ReturnType<T>

return {
html,
Expand Down

0 comments on commit 7b72ba2

Please sign in to comment.