Skip to content

Commit

Permalink
refactor: array input code
Browse files Browse the repository at this point in the history
  • Loading branch information
metalboyrick committed Oct 29, 2024
1 parent 2d384d6 commit c1336d7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/nextjs/app/debug/_components/contract/Array.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@ export const ArrayInput = ({
| Record<string, any>
| ((arg: Record<string, any>) => void),
) => {
let nextInputObject: Record<string, any> = nextInputRecipe;

// set state recipe function, handle
if (typeof nextInputRecipe === "function") {
nextInputObject = nextInputRecipe(parentForm!);
}
// if we find a function (a.k.a setState recipe), we run it to generate the next state based on recpe, else just use the object passed in
const nextInputObject: Record<string, any> =
typeof nextInputRecipe === "function"
? nextInputRecipe(parentForm!)
: nextInputRecipe;

setInputArr((currentInputArray: any) => {
return {
Expand Down

0 comments on commit c1336d7

Please sign in to comment.