-
Notifications
You must be signed in to change notification settings - Fork 4
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
[MI-400] Advanced Search with multi table view #535
Conversation
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 is looking great, awesome work! I know I left a good number of comments and am happy to hop in a call to work through them together if that helps 😄
props | ||
.searchFunction(searchTerm) | ||
.then((results) => { | ||
searchResults.value = results; | ||
}) | ||
.finally(() => { | ||
searching.value = false; | ||
}); |
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.
async/ await is easier to read and generally preferred when possible
props | |
.searchFunction(searchTerm) | |
.then((results) => { | |
searchResults.value = results; | |
}) | |
.finally(() => { | |
searching.value = false; | |
}); | |
searching.value = true; // Not sure if this is needed, I don't see where it gets set to `true` | |
searchResults.value = await props.searchFunction(searchTerm.value); | |
searching.value = false; |
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 don't think the searching.value is needed as the caller is setting it already. Because these are components we don't want to use await as that could have unintended consequences. Hence using a .then() which resolves after the result is available.
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.
Would we be able to move the searching.value = false
be next to the place that is being set to true
? Otherwise its hard to know if that is being triggered
What are the unintended consequences of using await
in components? I have used async
functions within many components without issue
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.
Actually I just looked at it and because the searchFunction is being called in a setTimeout method it's ok to add await. But generally component libraries functions being async is a little different, because then the consumer would need to know its async which 90% of our components are not.
onMounted(() => { | ||
window.addEventListener('click', onClickOutside); | ||
}); | ||
|
||
onUnmounted(() => { | ||
window.removeEventListener('click', onClickOutside); | ||
}); |
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 doesn't seem like the Vue way of doing things as its using plain JS event handlers. This could justify a new Vue hook with reactive state attached to it. This also seems like there is a concern for accessibility since people who don't utilize a mouse can't click outside (I would think focus would control this)
Feel free to ignore this one as it may be a decent lift to do some of this but wanted note it
src/components/AdvancedSearchBar/__tests__/AdvancedSearchBar.spec.ts
Outdated
Show resolved
Hide resolved
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! 🔥
JIRA
MI-400
Description
Our team is working on revamping the search experience and as a part the first step is to update the dropdown, here's the figma for the new dropdown view,
https://www.figma.com/design/XpIvfVpAYzgej225MXdcgL/Dashboard-v2?node-id=5198-903&t=DG2IJyhTMvrRKwdY-0
This component builds a multi table dropdown that can populate data from Campaigns, Orders, Templates etc