File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ module.exports = function normalizeComponent (
39
39
var hook
40
40
if ( isServer ) {
41
41
hook = function ( context ) {
42
+ // context is injected if this is a cached call
42
43
if ( ! context && typeof __VUE_SSR_CONTEXT__ !== 'undefined' ) {
43
44
context = __VUE_SSR_CONTEXT__
44
45
}
@@ -51,9 +52,14 @@ module.exports = function normalizeComponent (
51
52
// never gets called
52
53
options . _ssrRegister = hook
53
54
} else if ( injectStyles ) {
54
- var cssModules = injectStyles ( { } )
55
- if ( cssModules ) {
56
- hook = function ( ) {
55
+ var injected = false // only need to inject once on the client
56
+ var cssModules
57
+ hook = function ( ) {
58
+ if ( ! injected ) {
59
+ injected = true
60
+ cssModules = injectStyles ( { } )
61
+ }
62
+ if ( cssModules ) {
57
63
for ( var key in cssModules ) {
58
64
this [ key ] = cssModules [ key ]
59
65
}
You can’t perform that action at this time.
0 commit comments