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 duplicate when higher sub Term is selected "selectChildrenIfParentSelected". #774

Closed
wants to merge 1 commit into from

Conversation

aaclage
Copy link
Contributor

@aaclage aaclage commented Dec 27, 2020

| Bug fix? | [x]
| New feature? | [ ]
| New sample? | [ ]
| Related issues? | partially #765, mentioned in #765

What's in this Pull Request?

I use the property "selectChildrenIfParentSelected" to test the new functionality and think to found a issue when selecting terms on following sequence.
If selected Term(for the example Switzerland), selects all sub terms associated what is expected, but if select "countries" the terms are added twice, plus "countries".
This code fix validate existing and don't include twice.

image

image

@aaclage
Copy link
Contributor Author

aaclage commented Dec 29, 2020

Another issue that i find and wanted to validate with you @AJIXuMuK, want to know if this error also appears to you or only to me.
When i select a node the children's items are not selected and found the reason. It was in the code with operator (!) that should work as expected, since this is JS should work fine but it's not working (maybe some wrong mapping from typescript).
image
Term.tsx
Doesn't work (Tested in Chrome and Edge)

  public componentWillReceiveProps?(nextProps: ITermProps, nextContext: any): void {
    if (!this.props.multiSelection ) {

changed code below work as expected (Tested in Chrome and Edge)

  public componentWillReceiveProps?(nextProps: ITermProps, nextContext: any): void {
    if (this.props.multiSelection !== false) {

PS: didn't include in the code without your validation

@AJIXuMuK
Copy link
Collaborator

Hi @aaclage!
Thanks for your tests and contribution!

For the duplicates - there already was a code to exclude duplicates. But I didn't move it to correct line while implementing the feature. So, I've just modified the initial code instead of merging the PR.
I will still include you in the list of contributors though.

For the second issue - honestly, I don't think this condition should be there at all. I removed it and tested all possible scenarios of multiple selections + select children with parent.
Now everything looks good.

Again, thank you for the tests and contribution!

@AJIXuMuK AJIXuMuK closed this Dec 29, 2020
@aaclage aaclage deleted the Feature/FixMultipleSubTerms branch December 29, 2020 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants