Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key prop spread #129

Open
rogueturnip opened this issue Nov 4, 2024 · 1 comment
Open

Key prop spread #129

rogueturnip opened this issue Nov 4, 2024 · 1 comment

Comments

@rogueturnip
Copy link

rogueturnip commented Nov 4, 2024

Great library! Functionally things are rendering great but I'm seeing errors and when I submit all my select (enum) options fail validation.

Cannot update a component (`HotReload`) while rendering a different component (`SelectField`). To locate the bad setState() call inside `SelectField`, follow the stack trace as described in https://react.dev/link/setstate-in-render

SelectField.tsx:14 A props object containing a "key" prop is being spread into JSX:
  let props = {key: someKey, required: ..., error: ..., name: ..., onChange: ..., onBlur: ..., ref: ..., children: ...};
  <Select {...props} />
React keys must be passed directly to JSX without using spread:
  let props = {required: ..., error: ..., name: ..., onChange: ..., onBlur: ..., ref: ..., children: ...};
  <Select key={someKey} {...props} />

my code is very simple.

<AutoForm schema={new ZodProvider(detailSchemas[inspectionType])} onSubmit={onSubmit}>

Is this something I'm not setting up right or other?

Thanks!

@rogueturnip
Copy link
Author

I should mention.. my schema looks like this

  roof_gutters: z.object({
    materialType: z.enum(['Aluminum', 'Copper', 'Steel', 'Vinyl']),
    properlyAttached: z.boolean(),
    debrisFree: z.boolean(),
    properDrainage: z.boolean(),
    ...inspectionItemSchema
  }),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant