Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

"Select all" state incorrect after rerendering with additional options #134

Closed
randymorris opened this issue May 9, 2019 · 1 comment · Fixed by #135
Closed

"Select all" state incorrect after rerendering with additional options #134

randymorris opened this issue May 9, 2019 · 1 comment · Fixed by #135
Labels

Comments

@randymorris
Copy link
Contributor

Version

4.4.2

Here's what went wrong:

Exactly as described in the title. An example of this: https://codesandbox.io/s/43mvlo01k0.

Initially I thought this was related to #94 and had added some comments to that ticket but after fixing my issue I found that these are unrelated. I have since deleted those comments as they aren't helpful there. The useful info from those comments:

First, in Picky.UNSAFE_componentWillReceiveProps, the assumption is made that if the props.value is the same between current and next props, then the set of props is equal. It doesn't consider that props.options may differ.

Second, in Picky.allSelected - again, only the value is considered.

I think that if we were to check both options and value in both cases this probably is probably fixed. This would mean passing an additional overrideOptions to Picky.allSelected.

Pull request incoming.

Aidurber pushed a commit that referenced this issue May 10, 2019
If the number of options increases when rerendering but the number of
selected values stays the same, Picky should not report that all values
are selected.  This change adds additional checks to see if the number
of options changes between rerenders and sets the state accordingly.

✅ Closes: #134
@Aidurber
Copy link
Owner

🎉 This issue has been resolved in version 4.4.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

2 participants