Closed ChrisSG closed 4 months ago
the variable that was causing the issue is now initialized to null
so the problem should be gone. i'm going to close this issue but feel free to let me know if the problem still persists and we can figure out what to do
Describe the bug
Calling loadAll with
export const ssr = false
results in an error 500, but only on ios.I came to the conclusion that the behaviour of parallel fetching with loadAll results in calling initClient multiple times without awaiting the import of the client and thus initializing the
let client = null
.https://github.com/HoudiniGraphql/houdini/blob/6c5dbda72fb4b7c42dc85a3991e9705224dda080/packages/houdini-svelte/src/runtime/client.ts#L12
This results in a "Unhandled Promise Rejection: ReferenceError: Cannot access uninitialized variable."
Root cause would most probably be this bug in iOS / Safari combined with this behaviour: https://bugs.webkit.org/show_bug.cgi?id=242740
The question is if the behaviour of the code linked above is correct. On multiple calls on the same event-loop-level without awaiting the result - like
loadAll
does - the client variable will not be initialized and the import will be triggered multiple times.Also how does this interplay with sveltekit result streaming? (https://kit.svelte.dev/docs/load#streaming-with-promises)
Please be aware that due to the nature of the bug being only present on an iOS device I cannot easily provide a reproduction.
"houdini-svelte": "1.2.45",
"@sveltejs/kit": "1.21.0",
"svelte": "4.2.12",
WORKAROUND
Reproduction
No response