sveltejs / kit

web development, streamlined
https://kit.svelte.dev
MIT License
18.18k stars 1.85k forks source link

Warn when accessing locals during prerendering #11995

Open PatrickG opened 4 months ago

PatrickG commented 4 months ago

Describe the problem

A user on Discord needed days to solve a problem. The reason for this was that some routes were prerendered, which the helpers on Discord were not aware of. See #11981

Describe the proposed solution

Print a warning when accessing locals during prerendering. This could lead to some false positives, as some store a database connection to event.locals which gets used to fetch content while prerendering. However, I think this is a minority.

Alternatives considered

Do nothing.

Importance

would make my life easier

Additional Information

No response

charbelnicolas commented 4 months ago

Yes! this would save a lot of time on debugging said cases! Thank you Patrick!