Skip to content

Commit ca14930

Browse files
committed
appease eslint etc
1 parent c32747c commit ca14930

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

packages/svelte/src/internal/client/dom/blocks/each.js

Lines changed: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -234,24 +234,39 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
234234
/** @type {Set<import('#client').EachItem>} */
235235
var seen = new Set();
236236

237+
/** @type {import('#client').EachState | import('#client').EachItem} */
238+
var prev = state;
239+
240+
/** @type {import('#client').EachItem[]} */
241+
var to_animate = [];
242+
243+
/** @type {import('#client').EachItem[]} */
244+
var matched = [];
245+
246+
/** @type {import('#client').EachItem[]} */
247+
var stashed = [];
248+
249+
/** @type {V} */
250+
var value;
251+
252+
/** @type {any} */
253+
var key;
254+
255+
/** @type {import('#client').EachItem | undefined} */
256+
var item;
257+
237258
while (current) {
238259
lookup.set(current.k, current);
239260
current = current.next;
240261
}
241262

242263
current = first;
243264

244-
/** @type {import('#client').EachState | import('#client').EachItem} */
245-
var prev = state;
246-
247-
/** @type {import('#client').EachItem[]} */
248-
var to_animate = [];
249-
250265
if (is_animated) {
251266
for (let i = 0; i < array.length; i += 1) {
252-
var value = array[i];
253-
var key = get_key(value, i);
254-
var item = lookup.get(key);
267+
value = array[i];
268+
key = get_key(value, i);
269+
item = lookup.get(key);
255270

256271
if (item !== undefined) {
257272
item.a?.measure();
@@ -260,16 +275,10 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
260275
}
261276
}
262277

263-
/** @type {import('#client').EachItem[]} */
264-
var matched = [];
265-
266-
/** @type {import('#client').EachItem[]} */
267-
var stashed = [];
268-
269278
for (let i = 0; i < array.length; i += 1) {
270-
var value = array[i];
271-
var key = get_key(value, i);
272-
var item = lookup.get(key);
279+
value = array[i];
280+
key = get_key(value, i);
281+
item = lookup.get(key);
273282

274283
if (item === undefined) {
275284
prev = create_item(
@@ -300,13 +309,13 @@ function reconcile(array, state, anchor, render_fn, flags, get_key) {
300309
prev = stashed[0].prev;
301310
const a = get_first_child(stashed[0]);
302311

303-
for (var thing of matched) {
304-
move(thing, prev, a);
305-
prev = thing;
312+
for (item of matched) {
313+
move(item, prev, a);
314+
prev = item;
306315
}
307316

308-
for (var thing of stashed) {
309-
seen.delete(thing);
317+
for (item of stashed) {
318+
seen.delete(item);
310319
}
311320

312321
current = stashed[0];

packages/svelte/src/internal/client/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export { await_block as await } from './dom/blocks/await.js';
33
export { if_block as if } from './dom/blocks/if.js';
44
export { key_block as key } from './dom/blocks/key.js';
55
export { css_props } from './dom/blocks/css-props.js';
6-
export { identity, index, each } from './dom/blocks/each.js';
6+
export { index, each } from './dom/blocks/each.js';
77
export { html } from './dom/blocks/html.js';
88
export { snippet } from './dom/blocks/snippet.js';
99
export { component } from './dom/blocks/svelte-component.js';

0 commit comments

Comments
 (0)