supabase-js icon indicating copy to clipboard operation
supabase-js copied to clipboard

SvelteKit adapter saves outdated `fetch` function

Open notramo opened this issue 1 year ago • 0 comments

The SvelteKit adapter has a createSupabaseLoadClient, which caches the client when running in the browser. The only problem is that the SvelteKit-provided fetch function does a lot more under the hood, and saving it on the first run causes Supabase to use an outdated fetch, despite createSupabaseLoadClient being called with a different fetch on each subsequent run.

This does not seem like a big issue for basic load() functions, but it causes very difficult-to-debug situations when using advanced features of the SvelteKit router.

The above described problem is the biggest one in the caching mechanism, but it actually ignores any different value passed in the parameters when running subsequently.

The #438 issue describes a solution for the fetch problem.

notramo avatar Oct 21 '23 17:10 notramo