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

bug: Accordion multiple throws error if value is not an array #23550

Closed
EinfachHans opened this issue Jul 1, 2021 · 3 comments
Closed

bug: Accordion multiple throws error if value is not an array #23550

EinfachHans opened this issue Jul 1, 2021 · 3 comments
Labels
package: core @ionic/core package type: bug a confirmed bug report v6 issues specific to Framework v6
Milestone

Comments

@EinfachHans
Copy link
Contributor

Bug Report

Ionic version:

[ ] 4.x
[ ] 5.x
[X] 6.x

Current behavior:

When i have an Accordion, that has multiple: true and a value as a string (not an array), it throws an error whenever i try to collapse / expand something:

TypeError: groupValue.find is not a function. (In 'groupValue.find(v => v === accordionValue)',

Expected behavior:

I think this case needs an additional Check here:

if (!multiple && Array.isArray(value)) {
this.value = value[0];
} else {
this.ionChange.emit({ value: this.value });
}

Ionic info:

Ionic:

   Ionic CLI                     : 6.16.3 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 6.0.0-beta.0
   @angular-devkit/build-angular : 12.0.5
   @angular-devkit/schematics    : 12.0.5
   @angular/cli                  : 12.0.5
   @ionic/angular-toolkit        : 4.0.0

Capacitor:

   Capacitor CLI      : 3.0.2
   @capacitor/android : not installed
   @capacitor/core    : 3.0.2
   @capacitor/ios     : not installed

Utility:

   cordova-res (update available: 0.15.3) : 0.15.1
   native-run                             : 1.4.0

System:

   NodeJS : v14.15.4 (/usr/local/bin/node)
   npm    : 7.17.0
   OS     : macOS Big Sur
@ionitron-bot ionitron-bot bot added the triage label Jul 1, 2021
@liamdebeasi
Copy link
Contributor

liamdebeasi commented Jul 1, 2021

Thanks for the issue. Accordion group does not currently accept a comma separated string like components such as ion-datetime do, but it probably should otherwise this is going to be hard to use in vanilla JS environments.

Edit: The issue here is something different that I misunderstood initially. When passing in a string value to value with multiple="true", accordion group assumes that the value will be an array of strings when it could be that or a regular string.

My previous note about the comma separate array behavior is actually correct an in line with what we do in other components such as ion-select.

@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Jul 1, 2021
@ionitron-bot ionitron-bot bot removed the triage label Jul 1, 2021
@liamdebeasi liamdebeasi added this to the 6.0.0 milestone Jul 1, 2021
@liamdebeasi liamdebeasi added the v6 issues specific to Framework v6 label Jul 6, 2021
@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #23581, and a fix will be available in an upcoming release of Ionic Framework.

@ionitron-bot
Copy link

ionitron-bot bot commented Aug 18, 2021

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Aug 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report v6 issues specific to Framework v6
Projects
None yet
Development

No branches or pull requests

2 participants