@@ -5417,6 +5417,16 @@ function renderNode (node, isRoot, context) {
54175417 }
54185418}
54195419
5420+ function registerComponentForCache ( options , write ) {
5421+ // exposed by vue-loader, need to call this if cache hit because
5422+ // component lifecycle hooks will not be called.
5423+ var register = options . _ssrRegister ;
5424+ if ( write . caching && isDef ( register ) ) {
5425+ write . componentBuffer [ write . componentBuffer . length - 1 ] . add ( register ) ;
5426+ }
5427+ return register
5428+ }
5429+
54205430function renderComponent ( node , isRoot , context ) {
54215431 var write = context . write ;
54225432 var next = context . next ;
@@ -5426,15 +5436,9 @@ function renderComponent (node, isRoot, context) {
54265436 var Ctor = node . componentOptions . Ctor ;
54275437 var getKey = Ctor . options . serverCacheKey ;
54285438 var name = Ctor . options . name ;
5429-
5430- // exposed by vue-loader, need to call this if cache hit because
5431- // component lifecycle hooks will not be called.
5432- var registerComponent = Ctor . options . _ssrRegister ;
5433- if ( write . caching && isDef ( registerComponent ) ) {
5434- write . componentBuffer [ write . componentBuffer . length - 1 ] . add ( registerComponent ) ;
5435- }
5436-
54375439 var cache = context . cache ;
5440+ var registerComponent = registerComponentForCache ( Ctor . options , write ) ;
5441+
54385442 if ( isDef ( getKey ) && isDef ( cache ) && isDef ( name ) ) {
54395443 var key = name + '::' + getKey ( node . componentOptions . propsData ) ;
54405444 var has = context . has ;
@@ -5508,7 +5512,6 @@ function renderComponentInner (node, isRoot, context) {
55085512 node ,
55095513 context . activeInstance
55105514 ) ;
5511- node . ssrContext = null ;
55125515 normalizeRender ( child ) ;
55135516 var childNode = child . _render ( ) ;
55145517 childNode . parent = node ;
@@ -5520,15 +5523,21 @@ function renderComponentInner (node, isRoot, context) {
55205523}
55215524
55225525function renderElement ( el , isRoot , context ) {
5526+ var write = context . write ;
5527+ var next = context . next ;
5528+
55235529 if ( isTrue ( isRoot ) ) {
55245530 if ( ! el . data ) { el . data = { } ; }
55255531 if ( ! el . data . attrs ) { el . data . attrs = { } ; }
55265532 el . data . attrs [ SSR_ATTR ] = 'true' ;
55275533 }
5534+
5535+ if ( el . functionalOptions ) {
5536+ registerComponentForCache ( el . functionalOptions , write ) ;
5537+ }
5538+
55285539 var startTag = renderStartingTag ( el , context ) ;
55295540 var endTag = "</" + ( el . tag ) + ">" ;
5530- var write = context . write ;
5531- var next = context . next ;
55325541 if ( context . isUnaryTag ( el . tag ) ) {
55335542 write ( startTag , next ) ;
55345543 } else if ( isUndef ( el . children ) || el . children . length === 0 ) {
0 commit comments