Skip to content
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

Optimized async functional components fail to server-side render on initial render #12983

Open
vetruvet opened this issue Mar 15, 2023 · 0 comments

Comments

@vetruvet
Copy link

vetruvet commented Mar 15, 2023

Version

2.7.14

Reproduction link

stackblitz.com

Steps to reproduce

Run main.js in the reproduction link

What is expected?

Each render in that reproduction would work

What is actually happening?

The first render of OptimizedAsyncFunctionalComponent fails, but subsequent ones succeed.


It appears that vue-server-renderer calls installSSRHelpers which adds _ssrNode and other SSR optimization helpers to Vue.prototype and Vue.FunctionalRenderContext.prototype. However, when rendering an async functional component, the built version of vue-server-renderer has its own definition of FunctionalRenderContext (appears to be bundled at build time along with things like createFunctionalComponent instead of importing from vue itself at runtime) which does not have the SSR helpers on it.

Setting optimizeSSR: false in vue-loader options seems to work as a bandaid solution since the optimization helpers are not used, but this seems like a bad idea for performance.
EDIT: also, changing it to a regular component (not functional) also works as a workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant