-
Notifications
You must be signed in to change notification settings - Fork 2
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
web: add filter to own commits button #43
Conversation
This just sets up the component to make it easier to work with for the comming commits, but I did want to pull this out on its own to make it clear what code is just moved around and what is added as a result of the new feature.
Does what it says on the tin, because unfortunately MUI doesn't give that to us for free when using `<TextField />` - they do on `<Autocomplete />`, however.
I thought of a few ways about implementing this, but figured the cleanest was to just add the login data that we already have as an `endAdornment` on the `<TextField />`. In the event that we don't have `loginData` (for whatever reason), we just don't show the button - but this doesn't affect any of the existing functionality.
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.
Looks great, just two code points but happy
</IconButton> | ||
{loginData.data ? ( | ||
<IconButton | ||
onClick={() => setSearch(loginData.data.login)} |
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.
Should this (and onChange
above) be useCallback
'd to avoid child rerendering?
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.
Possibly.
However, realistically the entire component will be rerendering due to the fact that we're passing search
down to it, and that will change each time the user types something.
I thought of ways around this, but figured it didn't really matter for this use case.
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.
LG, thanks!
Ultimately, this PR does what it says on the tin, but I included two other refactoring-ish commits ahead of them with other stuff that I found whilst working on this.