-
Notifications
You must be signed in to change notification settings - Fork 586
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
Always render suggestions – fix #133 #155
Always render suggestions – fix #133 #155
Conversation
export const toggleAlwaysRenderSuggestions = sinon.spy((toggle, callback) => { | ||
app.setState({ | ||
alwaysRenderSuggestions: toggle, | ||
suggestions: getMatchingLanguages(app.state.value || 'elm') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 for "elm", but why || 'elm'
is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For those tests to be useful it is necessary to get suggestions even when there's no value in the input – that's why I use elm
here. It's not what would happen in a real-world app but does the same job for the tests' purpose.
I added a comment to make this clearer.
Overall looks great! Just a few minor comments above. |
5235f81
to
430f59e
Compare
As those tweaks were quite minor I just rebased them into my previous commits:
|
const { value } = inputProps; | ||
|
||
if (isCollapsed && lastAction !== 'click' && lastAction !== 'enter' && | ||
if (alwaysRenderSuggestions || isCollapsed && lastAction !== 'click' && lastAction !== 'enter' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need alwaysRenderSuggestions ||
here?
All tests pass without it, so I wonder if we can just remove it, or are we missing a test here?
@ThibWeb Thanks for the tweaks! I think I found an issue with the implementation. I just added if (!alwaysRenderSuggestions && isCollapsed) ... solves the issue, but it doesn't feel right. Basically, we have a prop and a state that control the view:
I feel that the prop should set the initial state. Then, What do you think? |
Yes, I've had some trouble understanding how best to interact with |
Checking in on this pull - do we expect to take it soon? |
@ThibWeb Have you had a chance to revisit this PR? |
Checking in to see if we expect this to be released soon. Thanks |
Hey there – sorry for the delay, I was on holidays for a few weeks. I still intend to work on this, and will commit to get back with a better PR this weekend. Hopefully this will be releasable. |
430f59e
to
603d8d1
Compare
@ThibWeb just wondering the status of this PR? I'd be happy to jump in and help out if you're running into issues or strapped for time. |
Hey @jxodwyer, strapped for time indeed. If you want to pick this up by all means go for it! Two weeks ago I did some work on this and a relevant UI example. That makes it easier to see why this is useful, what is going on, and where it fails. Useful links:
Next things to do IMHO:
I've added you as a contributor to https://github.com/ThibWeb/react-autosuggest, it's up to you if you prefer to use this as is or start from it in another repo 👌. Please let me know what you decide as I'll likely have more time next weekend. |
This feature is much needed indeed! Thanks for your hard work guys, can't wait to see that merged! |
d456896
to
f365921
Compare
@moroshko I have updated the PR, could you have a look? I followed your suggestions,
Those extra checks are useful, but having them within the Other than that, I added the relevant tests to check for:
And I updated https://rawgit.com/ThibWeb/react-autosuggest/demo/arr/demo/dist/index.html to make reviewing this easier. The last thing that's missing would be a CodePen link – not too sure how to proceed here, since this isn't something we can collaborate on via PRs? Edit: this PR is running in production at https://data1850.nz/chart 🚀 |
Just a heads up that if someone wants to use this sooner rather than later, I have a branch where this work is compiled and npm installable: https://github.com/ThibWeb/react-autosuggest/tree/feature/arr-compiled I'd advise against relying on someone else's branch in a fork for something serious, but you can easily fork it to your own GitHub account to be more certain that it will stay how it is, and then |
@ThibWeb I'm keen to review and merge this PR. Do you mind resolving the merge conflicts? (sorry, they appeared after I merged #165) |
@ThibWeb resolve conflicts please 😀 |
🙇 @ThibWeb I will pay you a beer when you come to France if you resolve the conflicts :) |
…houldRenderSuggestions
5baee6c
to
04b0c3f
Compare
Wuhu, conflicts merged! They were quite straightforward, only had to add the Regarding The running example at https://rawgit.com/ThibWeb/react-autosuggest/demo/arr/demo/dist/index.html is up to date. @moroshko this might not pass the linting since your latest config updates – I tried to make it work but |
Hi @moroshko, Any update on this new feature? When do you think it will be merged? Thanks |
nice @moroshko 🎉 |
Sending <3 to all of you! |
I cannot see the new "alwaysRenderSuggestions" prop on Autosuggest.js (v 3.9.0) Thanks |
|
Hey hey,
this is a PR to fix #133. It implements a new
alwaysRenderSuggestions
boolean prop, as we discussed. WhenalwaysRenderSuggestions={true}
, the checks to decide whether to render the suggestions are bypassed. Also comes with some documentation on this new prop, and relevant tests.I'd be keen to get a review of whether the tests are relevant and thorough enough, and make sure this new prop is used in the right places.
Also two things occurred to me while writing this PR:
react-autosuggest
is used on" somewhere).