Skip to content

Commit

Permalink
rf
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishiv committed Oct 16, 2024
1 parent 13581c4 commit 3dbaa99
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "alfama",
"version": "1.3.8",
"version": "1.3.9",
"author": "Abhishiv Saxena<abhishiv@gmail.com>",
"license": "MIT",
"description": "Fine-grained reactive library with no compiler, no magic, and no virtual DOM",
Expand Down
14 changes: 2 additions & 12 deletions src/stdlib/Each/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { TreeStep } from "../../dom/types";
import { getUtils, addNode, removeNode } from "../../dom/api";
import { reifyTree, getTreeStep } from "../../dom/traverser";
import { getValueUsingPath } from "../../utils/index";
import { createError } from "../../dom/utils";

export const Each: <T extends ArrayOrObject>(
props: {
Expand All @@ -42,10 +43,6 @@ export const Each: <T extends ArrayOrObject>(
onUnmount,
}
) => {
// todo: important memory leak
const $rootWire = wire(($: SubToken) => {});
setContext(ParentWireContext, signal("$wire", $rootWire));

const listCursor = props.cursor;
const store: StoreManager = (listCursor as any)[META_FLAG];
const listCursorPath: string[] = getCursor(listCursor);
Expand All @@ -57,7 +54,7 @@ export const Each: <T extends ArrayOrObject>(
) as typeof listCursor;
//console.log("value", value);
const isArray = Array.isArray(listValue);
if (!isArray) throw new Error("<Each/> needs array");
if (!isArray) throw createError(110);

const getItemCursor = (item: ExtractElement<typeof listCursor>) => {
const store: StoreManager = (listCursor as any)[META_FLAG];
Expand All @@ -71,13 +68,6 @@ export const Each: <T extends ArrayOrObject>(
return props.cursor[index];
} else {
// debugger;
console.error(
"accessing no existent item",
index,
item,
listValue,
listValue.length
);
}
};

Expand Down

0 comments on commit 3dbaa99

Please sign in to comment.