@@ -107,7 +107,7 @@ async function render({ source, element, selector, data, key, index, currentInde
107107 element = [ element ]
108108
109109 for ( let i = 0 ; i < element . length ; i ++ ) {
110- key = element [ i ] . getAttribute ( 'render' ) || key || type
110+ key = element [ i ] . getAttribute ( 'render' ) || key
111111
112112 let renderedNode = renderedNodes . get ( element [ i ] )
113113 if ( source ) {
@@ -118,12 +118,12 @@ async function render({ source, element, selector, data, key, index, currentInde
118118 }
119119
120120 if ( remove ) {
121- for ( let j = 0 ; j < data [ type ] . length ; j ++ ) {
121+ for ( let j = 0 ; j < data [ key ] . length ; j ++ ) {
122122 let cloneKey
123- if ( type === 'object' ) {
124- cloneKey = data [ type ] [ j ] . _id ;
123+ if ( key === 'object' ) {
124+ cloneKey = data [ key ] [ j ] . _id ;
125125 } else {
126- cloneKey = data [ type ] [ j ] . name ;
126+ cloneKey = data [ key ] [ j ] . name ;
127127 }
128128
129129 let clone = renderedNode . clones . get ( cloneKey )
@@ -135,20 +135,20 @@ async function render({ source, element, selector, data, key, index, currentInde
135135 }
136136 } else if ( key || Array . isArray ( data ) ) {
137137 if ( update ) {
138- for ( let j = 0 ; j < data [ type ] . length ; j ++ ) {
138+ for ( let j = 0 ; j < data [ key ] . length ; j ++ ) {
139139 let clone
140- if ( type === 'object' ) {
141- clone = renderedNode . clones . get ( data [ type ] [ j ] . _id ) ;
140+ if ( key === 'object' ) {
141+ clone = renderedNode . clones . get ( data [ key ] [ j ] . _id ) ;
142142 } else {
143- clone = renderedNode . clones . get ( data [ type ] [ j ] . name ) ;
143+ clone = renderedNode . clones . get ( data [ key ] [ j ] . name ) ;
144144 }
145145
146146 if ( ! currentIndex )
147147 currentIndex = data . $filter . currentIndex
148148
149149 if ( ! clone ) return
150150
151- await renderValues ( clone , { object : data [ type ] [ j ] } ) ;
151+ await renderValues ( clone , { object : data [ key ] [ j ] } ) ;
152152 if ( currentIndex >= 0 )
153153 insertElement ( renderedNode , clone , index , currentIndex )
154154 }
0 commit comments