-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Suggestions: add "use current input" command #3929
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
Conversation
|
@joschect I'd love some input on this one! |
| } | ||
|
|
||
| @autobind | ||
| public tryHandleKeyDown(keyCode: number, currentSuggestionIndex: number): boolean { |
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.
Add a comment that return true means it was handled, and false means it wasn't
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.
This entire function seems like it should be in the controller.
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.
How do I move this into the controller? The suggestionsController doesn't seem to be aware of the other elements in the suggestion element? (I may be missing something)
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.
It's not really supposed to be aware. That said it makes sense that it would need to be aware in order to manage stuff like this. Perhaps the answer is to make SuggestionsController a react element whose render function only returns <Suggestions>. That way it can have a ref to suggestions, which in turn exposes an api for stuff like clicking the "search more" button. The main goal, in my mind, is to keep the "state manager" (SuggestionsController, maybe it should get renamed?) separate from the "view" (Suggestions). That way it's easy to mix and match the two and each one is clean, there isn't a conflating of state and form.
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.
I've opened #3969 to address this
| @autobind | ||
| private _useInput() { | ||
| if (this.props.createGenericItem) { | ||
| this.props.createGenericItem(); |
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.
this feels more like it should be forceResolve or something like that.
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.
yes, that sounds like a much better name, I'll change that where applicable
Pull request checklist
$ npm run changeDescription of changes