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
Current server rendering is a bit limiting and difficult to extend because it does many things at once.
It creates a full VNode tree for an input, resolves teleports and returns a string.
In order to extend it (for example to await on special hook) you'll have to duplicate all that logic in your custom renderer.
Maybe it'll be beneficial to split resolving VNodes and rendering into separate actions?
This would also resolve an issue with runtime ssr helpers and renderToStream and allow both renderToStream and renderToString utilize the same buffer, resulting in a simpler code (rendering is bound to buffer constructor in renderToStream pull request).
What does the proposed API look like?
constssrContext=getSSRcontext(input)const{ buffer }=ssrContext// async buffer, an array of nested buffers of strings and promisesconststream=bufferToStream(buffer)conststring=awaitbufferToString(buffer)awaitresolveBuffer(buffer)// wait for VNode and Teleports to become readyssrContext.vnode// collect extra data from nodesssrContext.teleports// decide how to deal with teleports
Or alternatively pass an entire context for rendering to automatically resolve teleports:
What problem does this feature solve?
Current server rendering is a bit limiting and difficult to extend because it does many things at once.
It creates a full VNode tree for an input, resolves teleports and returns a string.
In order to extend it (for example to await on special hook) you'll have to duplicate all that logic in your custom renderer.
Maybe it'll be beneficial to split resolving VNodes and rendering into separate actions?
This would also resolve an issue with runtime ssr helpers and
renderToStream
and allow bothrenderToStream
andrenderToString
utilize the same buffer, resulting in a simpler code (rendering is bound to buffer constructor inrenderToStream
pull request).What does the proposed API look like?
Or alternatively pass an entire context for rendering to automatically resolve teleports:
The text was updated successfully, but these errors were encountered: