vue icon indicating copy to clipboard operation
vue copied to clipboard

SSR error during $style injection on cached components

Open henriqemalheiros opened this issue 7 years ago • 12 comments

Version

2.5.17

Reproduction link

https://github.com/henriqemalheiros/vue-ssr-cached-component-css-modules

Steps to reproduce

  • yarn install
  • yarn run ssr:build
  • yarn run ssr:start
  • Open http://localhost:8000/
  • Refresh the page

The error is also reproducible in development mode with yarn run ssr:serve.

What is expected?

The app should render properly, as it rendered before refreshing the page.

What is actually happening?

error during render : /
TypeError: Cannot set property '$style' of undefined
    at CachedComponent_injectStyles (src/components/CachedComponent.vue:8:0)
    at hook (node_modules/vue-loader/lib/runtime/componentNormalizer.js:53:0)
    at c:\[...]\vue-ssr-cached-component-css-modules\node_modules\vue-server-renderer\build.js:7467:15
    at c:\[...]\vue-ssr-cached-component-css-modules\node_modules\vue-server-renderer\build.js:2487:40
    at c:\[...]\vue-ssr-cached-component-css-modules\node_modules\vue-server-renderer\build.js:7465:11
    at c:\[...]\vue-ssr-cached-component-css-modules\node_modules\vue-server-renderer\build.js:2487:40
    at renderComponent (c:\[...]\vue-ssr-cached-component-css-modules\node_modules\vue-server-renderer\build.js:7463:7)
    at RenderContext.renderNode (c:\[...]\vue-ssr-cached-component-css-modules\node_modules\vue-server-renderer\build.js:7418:5)
    at RenderContext.next (c:\[...]\vue-ssr-cached-component-css-modules\node_modules\vue-server-renderer\build.js:2436:14)
    at cachedWrite (c:\[...]\vue-ssr-cached-component-css-modules\node_modules\vue-server-renderer\build.js:2295:9)

If you remove the serverCacheKey from the cached component and try again, the app renders properly.

Originally I thought this was a Nuxt related issue (nuxt/nuxt.js#3868). I then forgot about the issue, since I ditched component caching, but now I was able to find the time to reproduce it with plain Vue.

henriqemalheiros avatar Nov 01 '18 14:11 henriqemalheiros

Thanks for reporting this, we will have a look as soon as we can.

LinusBorg avatar Nov 06 '18 22:11 LinusBorg

@LinusBorg do you have any news about the issue?

iztsv avatar Feb 16 '19 14:02 iztsv

I have same issue :(

anzolo avatar Apr 16 '19 06:04 anzolo

any news?

andreynazarov3 avatar Nov 20 '19 07:11 andreynazarov3

It is very sad news that using "nuxt": "2.11.0" I still have the same bug

AntonMoskalchenko avatar Feb 19 '20 22:02 AntonMoskalchenko

any news?

v-angolenko avatar Dec 08 '20 19:12 v-angolenko

I faced the same problem

radislaw avatar Jan 14 '21 06:01 radislaw

any news?

whooooop avatar Jan 23 '21 09:01 whooooop

why is the problem still not solved?

devseregik avatar Aug 03 '21 07:08 devseregik

any news?

alexander-rodin avatar Sep 17 '22 16:09 alexander-rodin