Prevent a waterfall effect when needing to access locals
in a child page?
#9312
Unanswered
kevinrenskers
asked this question in
Q&A
Replies: 1 comment 4 replies
-
One way to fix this is to add a
And then in the child route's
And voila, the waterfall effect is gone. But that is a lot of boilerplate code, I'd have to copy the same |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm seeing a waterfall effect when loading data on a child page, when that child page calls
await parent()
purely to access an auth token which is stored inlocals
.I have a small reproduction example set up here: https://github.com/kevinrenskers/sk-loading-waterfall. Start up the server, navigate to http://127.0.0.1:5173/child and check the logs. You can see something like this:
This is a waterfall effect: B only starts after A is complete, purely because the child page needs access to the token, stored in locals, via
await parent()
. If you remove that call in the child page's+page.ts
file, you will see that both requests are now made at the same time.My question is how to prevent this waterfall effect from happening, when I need access to the token, stored in locals, in a child page?
Beta Was this translation helpful? Give feedback.
All reactions