@@ -3,6 +3,8 @@ import forEach from 'lodash/collection/forEach';
3
3
import find from 'lodash/collection/find' ;
4
4
import get from 'lodash/object/get' ;
5
5
import isEmpty from 'lodash/lang/isEmpty' ;
6
+ import keys from 'lodash/object/keys' ;
7
+ import uniq from 'lodash/array/uniq' ;
6
8
7
9
let utils = {
8
10
getContainerNode,
@@ -112,16 +114,17 @@ function prepareTemplateProps({
112
114
} ;
113
115
}
114
116
115
- function prepareTemplates ( defaultTemplates , templates ) {
116
- return reduce ( defaultTemplates , ( config , defaultTemplate , key ) => {
117
- let isCustomTemplate = templates && templates [ key ] !== undefined && ( templates [ key ] !== defaultTemplate ) ;
118
- if ( isCustomTemplate ) {
119
- config . templates [ key ] = templates [ key ] ;
120
- config . useCustomCompileOptions [ key ] = true ;
121
- } else {
122
- config . templates [ key ] = defaultTemplate ;
123
- config . useCustomCompileOptions [ key ] = false ;
124
- }
117
+ function prepareTemplates ( defaultTemplates = [ ] , templates = [ ] ) {
118
+ const allKeys = uniq ( [ ...( keys ( defaultTemplates ) ) , ...( keys ( templates ) ) ] ) ;
119
+
120
+ return reduce ( allKeys , ( config , key ) => {
121
+ const defaultTemplate = defaultTemplates [ key ] ;
122
+ const customTemplate = templates [ key ] ;
123
+ const isCustomTemplate = customTemplate !== undefined && ( customTemplate !== defaultTemplate ) ;
124
+
125
+ config . templates [ key ] = isCustomTemplate ? customTemplate : defaultTemplate ;
126
+ config . useCustomCompileOptions [ key ] = isCustomTemplate ;
127
+
125
128
return config ;
126
129
} , { templates : { } , useCustomCompileOptions : { } } ) ;
127
130
}
0 commit comments