Skip to content

[API Bug] Form.DatePicker and Form.Dropdown cannot be reset #443

@loris

Description

@loris

Raycast version: v1.25.7

Description

Both Form.DatePicker and Form.Dropdown should reset to their initial state if we change back their value prop to undefined, but it is not working as expected

Steps To Reproduce

  1. Use this simple test form code:
export default function TestForm() {
  const [date, setDate] = useState();

  return (
    <Form>
      <Form.DatePicker
        id="date"
        title="Date"
        value={date}
        onChange={(val) => {
          setDate(val);
          setTimeout(() => setDate(undefined), 2000);
        }}
      />
    </Form>
  );
}
  1. Render it and change the Date input to any value

The current behavior

The input will keep displaying the first selected value

The expected behavior

it should reset (ie, "No Date") after 2 seconds

Metadata

Metadata

Assignees

Labels

apiIssues related to APIbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions