Skip to content

Fix multi Async option issues#1629

Closed
w3-3w wants to merge 8 commits intoJedWatson:masterfrom
w3-3w:feature/add_option_for_multiAsync
Closed

Fix multi Async option issues#1629
w3-3w wants to merge 8 commits intoJedWatson:masterfrom
w3-3w:feature/add_option_for_multiAsync

Conversation

@w3-3w
Copy link

@w3-3w w3-3w commented Mar 28, 2017

The first two commits of this PR fixes #1542 and #1561 respectively.
The 3rd ~ 5th commit resolves an inconsistency problem as described in commit message.

As in #1289 , clearing options after selection for multi Async has been a default behavior. I introduced a new prop clearOptionsOnSelection , which defaults to true. For those who still need to keep options on selection, set it to false and it will behave as it did in v1.0.0-rc.2.

w3-3w added 2 commits March 28, 2017 16:19
whether clear option list or not on selection
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 92.45% when pulling 7cb42ae on w3-3w:feature/add_option_for_multiAsync into 93c3009 on JedWatson:master.

By now, on blur, the pulldown will be closed with options state unmodified. If we focus on it again, the previous options will be shown, even if nothing was typed as keyword. This makes it looks inconsistent.
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 92.336% when pulling 58e6e4b on w3-3w:feature/add_option_for_multiAsync into 93c3009 on JedWatson:master.

@gazpachu
Copy link

I've tested this PR and even if I set clearOptionsOnSelection={false}, the options in the select get removed when I start a new search

@w3-3w
Copy link
Author

w3-3w commented Apr 1, 2017

@gazpachu By start a new search did you mean clicking somewhere outside the component and focusing on it again? Maybe the third commit is questionable, but I think it is better to clear options on blur, because the keyword typed for search will be cleared on blur, or else it creates inconsistency on a second focus between keyword and options.

@gazpachu
Copy link

gazpachu commented Apr 1, 2017

@w3-3w the options on a multi select shouldn't be cleared ever. Only when the user clicks on the 'x' icon. ATM, in rc2 and rc3, the options are gone whenever a new search starts. The only become visible again if the search starts with the same letter as the options that were previously selected. For this reason, I had to disable the search funtionality.

I'm not sure if this is exactly the same issue you guys are talking about in this thread.

@gazpachu
Copy link

gazpachu commented Apr 1, 2017

No need to click outside the select, the issue happens just by starting a new search after having added a few options on the async multi select.

@gazpachu
Copy link

gazpachu commented Apr 1, 2017

@w3-3w Nevermind my previous messages. I've found the issue. It turns out that I was reloading all the options because of the input parameter was changing, so I stopped passing the input parameter to the API endpoint and now the search works fine. It doesn't remove any option.

loadOptions={input => this.loadData(filter.attributes.url, input)}

return axios.get('${API_URL}${API_PATH}${endpoint}?query=').then((response) => {

@coveralls
Copy link

Coverage Status

Coverage increased (+0.4%) to 93.146% when pulling cd4044d on w3-3w:feature/add_option_for_multiAsync into a0e5855 on JedWatson:master.

@hsingh23
Copy link

hsingh23 commented Apr 4, 2017

Does this fix the complete issue here: #1514?

@w3-3w
Copy link
Author

w3-3w commented Apr 5, 2017

@hsingh23 No. This PR focuses on option display behaviors.

@amit034
Copy link

amit034 commented Jun 18, 2017

any progress?

@picolll
Copy link

picolll commented Jul 20, 2017

Can someone merge this PR please. I'm waiting for it for a long time now.

@ndbroadbent
Copy link

This would be awesome, thanks @w3-3w! It would be great if this could be merged (but there's
a merge conflict now)

@ndbroadbent
Copy link

@w3-3w i'm using your branch, and the clearOptionsOnSelection option doesn't seem to do anything for me. The options are hidden as soon as I select one.

@ndbroadbent
Copy link

I've tried downgrading to 1.0.0-rc.2, but then there's a serious bug when using multiple Selects. They all seem to share the same options instead of loading them individually.

@begincalendar
Copy link

@w3-3w Thank you for creating this PR.

I have some constructive feedback for you:

  • I don't think you should conflate two issues with this (or any PR). As far as I can tell you are trying to fix Async Multiselect, options dropdown hides every time an option selected #1542 and Select.Async list disappear when two selected #1561 (which are the same issue, so that's fine), but then you also appear to be adding functionality to clear options when the field is blurred. I think the latter part should be stripped out into another PR. What do you think?
  • You appear to be doing some refactoring and bug fixing, as well as adding functionality. Related to the previous point, I think refactoring, bug fixing and feature addition should be split into separate PRs. Yes it takes more work on the part of the contributor, but it makes life easier for reviewers of PRs and also for future maintainers/contributors reviewing (master branch) squashed merge commit history. Would you agree?

@JedWatson
Copy link
Owner

Thanks for the PR @w3-3w

I believe all of the fixes you've included here have been implemented separately (and slightly differently, see the changelog) but this has been a great reference.

For what it's worth in the future, separate PRs for each feature will make it easier to merge 🙂

@JedWatson JedWatson closed this Sep 12, 2017
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.

Async Multiselect, options dropdown hides every time an option selected

9 participants