@blueshed/railroad 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/jsx.ts +10 -0
  2. package/package.json +1 -1
package/jsx.ts CHANGED
@@ -327,6 +327,16 @@ export function list<T>(
327
327
  // Existing keyed item — push new value into its signal
328
328
  entry.item!.set(arr[i]!);
329
329
  entry.index!.set(i);
330
+ } else {
331
+ // Index-based — dispose old, recreate with new item
332
+ const oldNode = entry.node;
333
+ entry.dispose();
334
+ pushDisposeScope();
335
+ const node = (keyFnOrRender as (item: T, index: number) => Node)(arr[i]!, i);
336
+ const dispose = popDisposeScope();
337
+ entry = { node, dispose };
338
+ entries.set(key, entry);
339
+ if (oldNode.parentNode) oldNode.parentNode.replaceChild(node, oldNode);
330
340
  }
331
341
 
332
342
  // Move or insert into correct position
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blueshed/railroad",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Signals, JSX, and routes — a micro UI framework for Bun",
5
5
  "type": "module",
6
6
  "main": "index.ts",