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

fix(Accordion): log error if incorrect activeIndex type #3199

Merged

Conversation

skindstrom
Copy link
Contributor

As discussed in PR #3193, this fix ensures that an Accordion will log an error if the incorrect type is given for activeIndex.

The expected types are:

  • number if exclusive
  • array if not exclusive

It will not log in production.

At first I considered doing the logging in the same lifecycle method that is used in Dropdown, however it uses the now deprecated componentWillReceiveProps. That's why I chose to log it in componentDidUpdate

In #3193 we also discussed further documentation, but I noticed that there is already an example of how to use an Accordion when exclusive is false.

I chose to not fix the crash that might occur when clicking a panel if the incorrect type for activeIndex is given, as the warning will be printed beforehand. If you feel this should be fixed, let me know.

You may go ahead and close #3192 , as this logging fixes the issue I had with it.

@codecov-io
Copy link

codecov-io commented Oct 7, 2018

Codecov Report

Merging #3199 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3199      +/-   ##
==========================================
+ Coverage   99.92%   99.92%   +<.01%     
==========================================
  Files         169      169              
  Lines        2790     2801      +11     
==========================================
+ Hits         2788     2799      +11     
  Misses          2        2
Impacted Files Coverage Δ
src/modules/Accordion/AccordionAccordion.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f140550...6fcf14d. Read the comment docs.

@layershifter layershifter changed the title fix(Accordion): log error if incorrect activeIndex type (#3192) fix(Accordion): log error if incorrect activeIndex type Oct 10, 2018
@layershifter layershifter merged commit 79d5da8 into Semantic-Org:master Oct 23, 2018
@layershifter
Copy link
Member

@SimonKinds finally merged, thanks for your work 👍 Sorry for delay, there were issues with Codecov, only manual changes fixed them:

image

@skindstrom
Copy link
Contributor Author

No worries, thanks for being a wonderful maintainer!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Accordion: activeIndex must be array if exclusive = false
3 participants