-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
init doesn't work as intended in production #13347
Comments
There are really two init hooks...the client init hook which you are using runs once when the application start on the client (basically on every hard refresh). The server one runs once every time the server starts the sveltekit application. In case of server less tho everytime your server less function goes to sleep is just like if the server shut down and with a new request it needs to spin up again (and the init hook will and need to rerun to re initialize everything) |
@paoloricciuti Hi thanks for the reply, but in my case the code inside the init hook doesn't even run |
@retr0cube please provide a repro of your problem:
We get a lot of issues, so being able to pull your code and deploy it rather than faff about talking to you and trying to figure out what the issue is by ourselves makes it a lot more likely we can get a fix out quickly 😉 |
Describe the bug
Hi,
Using
init
in ahooks.client.ts
file would work as intended but not in production (Vercel in my case)Reproduction
hooks.client.ts
withinit
that does some logicLogs
System Info
Severity
serious, but I can work around it
Additional Information
According to the docs:
Does this mean that the init function in a vercel instance runs ONLY when the server has started? But what about the second part of the statement? Am I misunderstanding the docs here?
The text was updated successfully, but these errors were encountered: