You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The transport hook added in 2.11.0 is insufficient for returning long lived variables from load functions, such as ReadableStreams/async iterators and Observables
Describe the proposed solution
Split the transport encode/decode into hooks.server.js and hooks.client.js to allow for long lived variables to be serialized into IDs by the user, then revived on the client using an SSE or Websocket connection, similar to how Promises are already serialized into unique IDs that are attached to the window and resolved later.
Ideally this should also not leak the server implementation to the client
Alternatives considered
You can return an ID from a load function, then set up the SSE connection from the client, but this is brittle and not reusable
Describe the problem
The transport hook added in 2.11.0 is insufficient for returning long lived variables from load functions, such as ReadableStreams/async iterators and Observables
Describe the proposed solution
Split the transport encode/decode into hooks.server.js and hooks.client.js to allow for long lived variables to be serialized into IDs by the user, then revived on the client using an SSE or Websocket connection, similar to how Promises are already serialized into unique IDs that are attached to the window and resolved later.
Ideally this should also not leak the server implementation to the client
Alternatives considered
You can return an ID from a load function, then set up the SSE connection from the client, but this is brittle and not reusable
Importance
nice to have
Additional Information
Feature announcement: https://bsky.app/profile/svelte.dev/post/3ld4ncjryfs2g
Feature PR: #13149
PR that would fix this: #13125
Similar to: #13156
The text was updated successfully, but these errors were encountered: