Skip to content

Commit

Permalink
chore(core): cleanup array range formatting
Browse files Browse the repository at this point in the history
Also remove a commented item that was used for reference
  • Loading branch information
soup-in-boots committed May 2, 2024
1 parent 1f72e17 commit 362264c
Showing 1 changed file with 10 additions and 23 deletions.
33 changes: 10 additions & 23 deletions packages/core/src/components/mapper/array/Range.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ export function Range(props) {
const { start, end, form, onChange } = props;
const keys = useArrayKeyRange(start, end);
const type = useMemo(() => ObjectPath.stringify(form.key), [form.key]);
return <>
{useMemo(() =>
keys.map(
(key, offset) => <Item
const items = useMemo(() =>
keys.map(
(key, offset) => (
<Item
key={key}
id={key}
onChange={onChange}
Expand All @@ -24,24 +24,11 @@ export function Range(props) {
forms={form.items}
type={type}
/>
),
[keys, onChange, form]
)}
)
),
[keys, onChange, form]
);
return <>
{items}
</>;
}

/**
* <Item
* key={key}
* {...array}
* id={key}
* forms={parent.items}
* index={index}
* form={form}
* parent={parent}
* type={type}
* schema={schema}
* onChange={onChange}
* value={array.model[index]}
* />
*/

0 comments on commit 362264c

Please sign in to comment.