Some help figuring out why +page.server.js load functions are not firing #12156
Unanswered
dimitarnikolovv
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I recently decided to localize my site using the sveltekit-i18n library, following this example. The problem is that in it the handle hook seems to mess with the load functions when redirecting using the default locale. I tried to debug the problem but my understanding of sveltekit's data loading is not on that level.
This is my version of the handle hook:
There are three locales
en
,bg
, andpl
. The idea is however when navigating using thedefaultLocale
(bg
) to remove it from the URL. For examplesomesite.eu/bg/services
becomessomesite.eu/services
. And it works as expected, but when navigating to a page that is dependent on data provided by a load function it just won't trigger the load function. This behavior is only present when navigating using thedefaultLocale
. Or in other words only when the handle hook tries to redirect to a non-localized URL. For example, navigation tosomesite.eu/services
won't trigger the+page.server.js
load function, butsomesite.eu/en/services
will.For this reason, this is the route structure that the example suggests:
Beta Was this translation helpful? Give feedback.
All reactions