Skip to content

Commit

Permalink
don't check mapFn length
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexErrant committed Jan 5, 2025
1 parent 71f6c5e commit 5b04714
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/keyed/dev/entries.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// changes to this file might be applicable to similar files - grep 95DB7339-BB2A-4F06-A34A-25DDF8BF7AF7

import { createStore, produce } from "solid-js/store";
import { createStore } from "solid-js/store";
import { createEffect } from "solid-js";
import { Entries } from "../src/index.js";
import { TransitionGroup } from "solid-transition-group";
Expand Down
18 changes: 3 additions & 15 deletions packages/keyed/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,8 @@ export function Entries<K extends string | number, V>(props: {
const mapFn = props.children;
return createMemo(
mapArray(
() => props.of && Object.keys(props.of),
mapFn.length < 3
? key =>
(mapFn as (key: string, v: Accessor<V>) => JSX.Element)(
key,
() => props.of![key as never],
)
: (key, i) => mapFn(key as never, () => props.of![key as never], i),
() => props.of && (Object.keys(props.of) as never[]),
(key, i) => mapFn(key, () => props.of![key], i),
"fallback" in props ? { fallback: () => props.fallback } : undefined,
),
) as unknown as JSX.Element;
Expand Down Expand Up @@ -227,13 +221,7 @@ export function MapEntries<K, V>(props: {
return createMemo(
mapArray(
() => props.of && Array.from(props.of.keys()),
mapFn.length < 3
? key =>
(mapFn as (key: K, v: Accessor<V>) => JSX.Element)(
key,
() => (props.of as Map<K, V>).get(key)!,
)
: (key, i) => mapFn(key, () => (props.of as Map<K, V>).get(key)!, i),
(key, i) => mapFn(key, () => (props.of as Map<K, V>).get(key)!, i),
"fallback" in props ? { fallback: () => props.fallback } : undefined,
),
) as unknown as JSX.Element;
Expand Down

0 comments on commit 5b04714

Please sign in to comment.