Conversation
Adds handleLoad and handleServerLoad hooks that run before any invocation of a corresponding load function. closes #9542
|
|
Noting the brief discussion Rich and I had about this: The fact that you need to be very careful about which things to read in |
|
Is it necessary to track anything at all inside the hooks? It feels like that should happen inside the root layout instead and the hook should only be used for logging, modifying, ... |
|
If you implement an auth guard you may want to ensure it runs on every request |
|
Yeah sure, but would it be a problem to always run the hook when the load function chain starts? It feels more intuitive to me, very similar to how the handle hook works. |
|
|
|
Ah alright. But still, why do we need to track anything then? If your page load function depends on something that runs inside handleLoad it will always be there if it always runs. I don't see why you would need tracking. Maybe I just need an example that makes use of that functionality |
|
I believe there was discussion around providing an untracked version of event properties alongside the main tracked one at some point? Something like this would greatly help us at Sentry. For example to obtain route information. Worth noting that we don't alter any behaviour based on reading these values so I don't think it should cause an invalidation. |
|
@Lms24 did fly a bit under the radar, but a mechanism to not cause reruns from reading properties exists in 2.0: https://kit.svelte.dev/docs/load#rerunning-load-functions-untracking-dependencies In fact, it's used in this PR - else |
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
|
Hi, is there anything I can help with to get this merged? |
Hi Lukas. There's still some deliberation ongoing due to the concern mentioned in #11313 (comment) and we're not sure how to address this yet. |
|
Gonna go ahead and close this, since a) we never found a satisfactory answer to the concerns about invalidation, b) we're moving to a world where |
Adds handleLoad and handleServerLoad hooks that run before any invocation of a corresponding load function.
closes #9542
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm testand lint the project withpnpm lintandpnpm checkChangesets
pnpm changesetand following the prompts. Changesets that add features should beminorand those that fix bugs should bepatch. Please prefix changeset messages withfeat:,fix:, orchore:.