File tree Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Expand file tree Collapse file tree 1 file changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ exports._applyFilter = function (id, args) {
2121 * Resolve a component, depending on whether the component
2222 * is defined normally or using an async factory function.
2323 * Resolves synchronously if already resolved, otherwise
24- * resolves asynchronously and replaces the factory with
25- * the resolved component .
24+ * resolves asynchronously and caches the resolved
25+ * constructor on the factory .
2626 *
2727 * @param {String } id
2828 * @param {Function } cb
@@ -34,14 +34,21 @@ exports._resolveComponent = function (id, cb) {
3434 _ . assertAsset ( raw , 'component' , id )
3535 // async component factory
3636 if ( ! raw . options ) {
37- raw ( function resolve ( res ) {
38- if ( _ . isPlainObject ( res ) ) {
39- res = _ . Vue . extend ( res )
40- }
41- registry [ id ] = res
42- cb ( res )
43- } )
37+ if ( raw . resolved ) {
38+ // cached
39+ cb ( raw . resolved )
40+ } else {
41+ raw ( function resolve ( res ) {
42+ if ( _ . isPlainObject ( res ) ) {
43+ res = _ . Vue . extend ( res )
44+ }
45+ // cache resolved
46+ raw . resolved = res
47+ cb ( res )
48+ } )
49+ }
4450 } else {
51+ // normal component
4552 cb ( raw )
4653 }
4754}
You can’t perform that action at this time.
0 commit comments