-
Notifications
You must be signed in to change notification settings - Fork 20
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
Debounce transporter input #729
Debounce transporter input #729
Conversation
Thanks @sheckathorne! I know we already discussed this, I'll review this before the end of this week. |
|
||
describe('useDebounce hook', () => { | ||
beforeAll(() => { | ||
vi.useFakeTimers(); // Use fake timers |
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 looks like it was written by AI, which is fine (if it works and isn't doing it in some backwards way), but it doesn't make sense use comments like// use fake times
to explain a function call called vi.useFakeTimers()
. same for the rest of the test.
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 notice that it's still sending a request with an empty epaID when the user moves focus away from the select input, which I believe it was doing before anyways(?) We can remove that call by modifying the skip option in the const { data } = useSearchRcraSitesQuery(
{
siteType: handlerType,
siteId: debouncedInputValue,
},
{ skip: skip || debouncedInputValue === '' }
); @sheckathorne, do you have the time to modify the PR to fix this? I would hate to not clear this technical debt while we're already here. If not I can make these changes. |
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.
everything looks good, just some minor edits.
Sorry I missed your comments, I have been traveling. I will make these edits today and also admit that I had some help with writing only the tests :) |
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.
Awesome Possum!
Appreciate the work @sheckathorne
Description
Debounces the transporter input in the manifest form while also reducing the minimum number of characters from 5 to 2 before results begin populating. Debounce will limit the number of requests made to the server when typing-to-search while the reduction in characters will allow the user to display results earlier.
Issue ticket number and link
#727
Checklist