Skip to content

Commit ffa45dd

Browse files
committed
tweaks
1 parent a2d09c2 commit ffa45dd

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/generators/nodes/EachBlock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export default class EachBlock extends Node {
319319
block.builders.update.addBlock(deindent`
320320
var ${each_block_value} = ${snippet};
321321
322-
@updateKeyedEach(#component, ${key}, changed, "${this.key}", ${dynamic}, ${each_block_value}, ${head}, ${lookup}, ${updateMountNode}, ${String(this.block.hasOutroMethod)}, ${create_each_block}, function(#i) {
322+
@updateKeyedEach(#component, ${key}, changed, "${this.key}", ${dynamic}, ${each_block_value}, ${head}, ${lookup}, ${updateMountNode}, ${String(this.block.hasOutroMethod)}, ${create_each_block}, "${mountOrIntro}", function(#i) {
323323
return @assign({}, state, {
324324
${this.contextProps.join(',\n')}
325325
});

src/shared/keyed-each.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export function outroAndDestroyIteration(iteration, lookup) {
1717
});
1818
}
1919

20-
export function updateKeyedEach(component, key, changed, key_prop, dynamic, list, head, lookup, updateMountNode, hasOutroMethod, create_each_block, get_context) {
20+
// TODO is it possible to avoid mounting iterations that are
21+
// already in the right place?
22+
export function updateKeyedEach(component, key, changed, key_prop, dynamic, list, head, lookup, node, has_outro, create_each_block, intro_method, get_context) {
2123
var keep = {};
2224

2325
var i = list.length;
@@ -36,7 +38,7 @@ export function updateKeyedEach(component, key, changed, key_prop, dynamic, list
3638
keep[key] = 1;
3739
}
3840

39-
var destroy = hasOutroMethod
41+
var destroy = has_outro
4042
? outroAndDestroyIteration
4143
: destroyIteration;
4244

@@ -55,7 +57,7 @@ export function updateKeyedEach(component, key, changed, key_prop, dynamic, list
5557

5658
var anchor;
5759

58-
if (hasOutroMethod) {
60+
if (has_outro) {
5961
var next_key = next && next.key;
6062
var neighbour = iteration.next;
6163
var anchor_key;
@@ -69,7 +71,7 @@ export function updateKeyedEach(component, key, changed, key_prop, dynamic, list
6971
anchor = next && next.first;
7072
}
7173

72-
iteration[iteration.i ? 'i' : 'm'](updateMountNode, anchor);
74+
iteration[intro_method](node, anchor);
7375

7476
iteration.next = next;
7577
if (next) next.last = iteration;

0 commit comments

Comments
 (0)