saas-js / saas-ui

The React component library for startups, built with Chakra UI.
https://saas-ui.dev
MIT License
1.23k stars 118 forks source link

AutoForm select field types is missing options #203

Closed lwolle closed 4 months ago

lwolle commented 5 months ago

Description

When I use a form field of type select in the AutoForm component, I expect it to be able to provide options, but TypeScript errors with the error message below TS2353: Object literal may only specify known properties, and options does not exist in type SchemaField

and I expect the provided defaultValue to be taken into account in the form result.

Link to Reproduction

https://codesandbox.io/p/sandbox/still-rain-cxc6w2

Steps to reproduce

Part 1

  1. Open the repro
  2. Inspect the code
  3. the form schema is typed as ObjectSchema

Part 2

  1. Hit submit
  2. Inspect the result and expect the object to resemble
    {
    toxic:  "no",
    }

    the actual result is

    {
    toxic: undefined,
    }

Saas UI Version

2.5.5

Chakra UI Version

2.8.2

Browser

Brave 1.61.104

Operating System

Additional Information

No response

linear[bot] commented 5 months ago

SUI-399 AutoForm select field types is missing options

Pagebakers commented 5 months ago

Thanks for the elaborate explanation! The code sandbox doesn't exist it says, maybe it's private?

lwolle commented 5 months ago

codesandbox.io/p/sandbox/still-rain-cxc6w2

Sorry about that. I made it public now.

Pagebakers commented 5 months ago

Found the issue, looking for a fix now.