Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

(v3) preload in context="module" not registering until restart #611

Closed
arxpoetica opened this issue Mar 16, 2019 · 4 comments · Fixed by #844
Closed

(v3) preload in context="module" not registering until restart #611

arxpoetica opened this issue Mar 16, 2019 · 4 comments · Fixed by #844
Labels

Comments

@arxpoetica
Copy link
Member

arxpoetica commented Mar 16, 2019

This might be a Svelte issue, but filing it here.

There's a weird thing happens in v3 Sapper/Svelte where preload works in some components/pages and not others. Even identical code within preload.

Turns out it does work the same in these components/pages. One just has to completely restart Sapper for the new context="module" script to register the preload.

Example without restart:

Given:

<script>export let user;</script>

One will see the following error:

was created without expected prop 'user'

Restarting, the error goes away, and preload works.

@Conduitry
Copy link
Member

I'm hoping this was fixed in 0.27.5 by #713.

@tkroll
Copy link

tkroll commented Aug 2, 2019

Still seeing this in v0.27.8.

@ematipico
Copy link

I can confirm that I'm still seeing this issue

@sanderhahn
Copy link
Contributor

sanderhahn commented Aug 12, 2019

The create_manifest_data function has the logic has_preload (https://github.com/sveltejs/sapper/blob/master/src/core/create_manifest_data.ts#L16) which value is cached in the data_manifest.components structure. When files in the src/routes are added/removed the preloads are rechecked, however this doesn't happen when the content of an individual page is updated. So this problem seem to occur when an empty route/page is added and the preload function is added/removed at a later time. The preload is important because it affects the code generation in create_app (https://github.com/sveltejs/sapper/blob/master/src/core/create_app.ts#L169).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants