Skip to content

bug: React IonSelect "multiple" gets into infinite render loop #24691

Closed

Description

@aruljayaraj

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

  1. Select multiple values from the Colors Set 2 dropdown
  2. Check the console on the onIonChange and onSubmit event
  3. Selected values not displayed onSubmit, it causes an infinite loop.

Expected Behavior

I've recently upgraded the @ionic/react version from 5.6.1 to 6.0.4(latest) in my project and also updated the RHF from 6.14.1 to 7.25.3(latest). I would like to get the selected colors during onSubmit. It was working in the lower version of Ionic.

Also, I've raised a ticket with the RHF and they investigated this issue, RHF side is working fine. Here is the discussion link. react-hook-form/react-hook-form#7708

What is the motivation of valueChanged detection and then emit change?

Steps to Reproduce

  1. Go to the given Sandbox link
  2. Select multiple values from the Colors Set 2 dropdown
  3. Check the console on the onIonChange and onSubmit event
  4. Selected values not displayed onSubmit, it causes an infinite loop.

Code Reproduction URL

https://codesandbox.io/s/infallible-feather-50dtb?file=/src/App.tsx

Ionic Info

No response

Additional Information

No response

Activity

  1. sean-perkins commented on Feb 2, 2022

    @sean-perkins
    Contributor

    Hello @aruljayaraj thanks for the issue!

    This appears to be a duplicate of #20106, we will track the issue through that ticket.

    A community member has commented a workaround that may be helpful in the interim to addressing the core issue: #20106 (comment).

  2. ionitron-bot commented on Mar 4, 2022

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  3. locked and limited conversation to collaborators on Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions