Skip to content
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

Fix search debounce #187

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Fix search debounce #187

wants to merge 2 commits into from

Conversation

rubo
Copy link
Contributor

@rubo rubo commented Aug 15, 2024

Fixed AVS search debounce not to make many requests in a row when search parameters changed. This has been caused by incorrect dependency configuration in useEffect. Therefore, useEffect is now split into 2 different ones with different set of dependencies.

The fix should be applied to other views as well.

@@ -107,44 +107,49 @@ export default function AVSList() {

const handlePageClick = useCallback(
page => {
setSearchParams({ page: page.toString() });
searchParams.set('page', page.toString());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to copy it before mutating?

@rubo rubo added the bug Something isn't working label Aug 15, 2024
Copy link
Collaborator

@Zishan-7 Zishan-7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multiple API requests bug is fixed but now if I change the page and try to go back using browser's back button, I have to click 2 times to return to the previous page.

Screen.Recording.2024-09-13.at.5.43.18.PM.mov

@vincenthongzy
Copy link
Collaborator

vincenthongzy commented Sep 13, 2024

@rubo does the same behaviour happen for AVS details operator table? I implemented the search functionality slightly differently there

@rubo
Copy link
Contributor Author

rubo commented Sep 13, 2024

@vincenthongzy I checked; it works fine. Maybe we can apply that approach here as well to avoid issues with navigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants