-
-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
headTags
are empty when using pipeToWebWritable
#27
Comments
pipeToWebWritable
headTags
are empty when using pipeToWebWritable
Hey @daliborgogic Thanks for the issue. I'm not entirely sure how to solve this, as head tags are written as the Vue app is rendered. Do you have any ideas? |
headTags
are empty when using pipeToWebWritable
headTags
are empty when using pipeToWebWritable
@harlan-zw For now no idea. Will check what we can and what we can with |
have you tried this code @daliborgogic @harlan-zw ? const appHtml = await renderToString(app);
const { headTags } = await renderSSRHead(head); I had the same case, then I was able to solve it by changing the order, first |
Isn't that just regular SSR? My understanding of the Vue rendering stream is that it's sending chunks as they are rendered so the head data would need to be appended as it's rendered, which it isn't for performance reasons. |
@harlan-zw yes, it's regular SSR. You are right. Workaround until there is a better way - const { headTags } = await renderSSRHead(head)
+ const decoder = new TextDecoder()
+ let c
+ let once = false
const { readable, writable } = new TransformStream({
- start() {/**/},
+ async transform(chunk, controller) {
+ if (!once) {
+ const decodedChunk = decoder.decode(chunk)
+ const { headTags } = await renderSSRHead(head)
+ const replacedHead = prepend.replace(`<!--head-->`, headTags)
+ const encodedChunk = encoder.encode(replacedHead + decodedChunk)
+ c = encodedChunk
+ once = true
+ } else {
+ c = chunk
+ }
+ controller.enqueue(c)
+ },
flush(controller) {
controller.enqueue(encoder.encode(append))
}
}) |
Going to track here #396 which is part of the v2 roadmap. |
The text was updated successfully, but these errors were encountered: