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

[bug]: Updating filters results in multiple requests #866

Open
CyanFlare opened this issue Feb 3, 2025 · 3 comments · May be fixed by #869
Open

[bug]: Updating filters results in multiple requests #866

CyanFlare opened this issue Feb 3, 2025 · 3 comments · May be fixed by #869

Comments

@CyanFlare
Copy link

Describe the bug

When updating filters it will make multiple requests instead of just one.

How to reproduce

  1. go to https://table.sadmn.com/
  2. open network tab of dev tools
  3. add any 1 filter (status or priority)
  4. look at network tab of dev tools. you see 2 requests being made for 1 filter change

Link to reproduction

https://table.sadmn.com/

Additional information

Here is a video showing the bug.

Desktop.2025.02.03.-.16.08.37.06.DVR.mp4
@piotrkulpinski
Copy link

This is actually a lot worse than it looks. Typing in the search filter will trigger a request on every key stroke (it's not even debounced/throttled).

CleanShot.2025-02-05.at.12.41.57.mp4

This is caused by setting this line: https://github.com/sadmann7/shadcn-table/blob/main/src/hooks/use-data-table.ts#L308

Also, not really sure why there are separate useQueryState calls for page, perPage and sort instead of using the cached filters from https://github.com/sadmann7/shadcn-table/blob/main/src/app/_lib/validations.ts#L17?

@piotrkulpinski piotrkulpinski linked a pull request Feb 5, 2025 that will close this issue
@piotrkulpinski
Copy link

Submitted a PR to fix this 👍

@CyanFlare
Copy link
Author

Submitted a PR to fix this 👍

Just tested the changes in my project and it works great so far. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants