question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Do not run `load` function if in hook's `handle` I disabled ssr at all

See original GitHub issue

Describe the problem

If I have:

  • hooks.ts:
/** @type {import('@sveltejs/kit').Handle} */
export function handle({ event, resolve }) {
	return resolve(event, { ssr: false });
}

I should not have the below error in console:

window is not defined

if I don’t use if (browser) {} in context="module"'s load() function.

Importance

would make my life easier

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
dummdidummcommented, Feb 19, 2022

Can someone please first provide an actual reproduction so we know what exactly you are talking about?

0reactions
antonycommented, Apr 4, 2022

Closing this issue in the absence of a reproduction. Feel free to re-raise if a reproduction is created.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hooks • Docs • SvelteKit
This function runs every time the SvelteKit server receives a request — whether that happens while the app is running, or during prerendering...
Read more >
SvelteKit: disable SSR - server side rendering - Stack Overflow
Show activity on this post. Basically now you disable SSR on a per page/layout level, so instead of in src/hooks. server. js (yes,...
Read more >
Invalid Hook Call Warning - React
Do not call Hooks inside functions passed to useMemo , useReducer , or useEffect . If you break these rules, you might see...
Read more >
Using Non-SSR Friendly Components with Next.js
no -ssr is a React component that wraps non-SSR components. This wrapper makes it easy to deal with client-only components when working with...
Read more >
useHooks - Easy to understand React Hook recipes
We bring you easy to understand React Hook code recipes so you can learn how React hooks work and feel more comfortable writing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found