Skip to content

Select.onChange is triggered when Select.options is changed #639

@yinonburgansky

Description

@yinonburgansky

Describe the bug

Select.onChange is triggered when Select.options is changed,
even though Select.value didn't change.

According to the docs:

onChange (value: T | Array) => void
Event handler called when the value changes.

To Reproduce

https://stackblitz.com/edit/github-kgvrt2gr-ess6xamn?file=src%2Froutes%2Findex.tsx

  1. Click on "Add new option to Select" button
  2. View the Select.onChange trigger count incremented even though the value didn't change.

Expected behavior

Updating Select.options shouldn't trigger Select.onChange.
According to the docs Select.onChange should only trigger when Select.value changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions