ratty-blush
ratty-blush4mo ago

setFilters fetch twice

When I use setFilters without syncWithLocation, why useTable the first fetch previous data and second fetch current data in useEffect?
7 Replies
kapa.ai
kapa.ai4mo ago
Hi @RomaY. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Hmm, I don't know enough to give you a confident answer yet. The knowledge sources provided do not contain specific information about setFilters causing useTable to fetch data twice when used without syncWithLocation. However, it's important to note that setFilters function in useTable hook triggers a new fetch every time there's a change in the filters state. This is because useTable is designed to keep the table state (including filters) in sync with the data displayed. If setFilters is called twice with different filter states, it could potentially trigger two fetches. For more details, you might find the following documentation helpful: - useTable Filtering (https://refine.dev/docs/data/hooks/use-table#filtering) - useTable setFilters (https://refine.dev/docs/ui-integrations/ant-design/hooks/use-table#setfilters) ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4mo ago
<@538717491908575242> kapa.ai is still learning and improving, please let us know how it did by reacting below
ratty-blush
ratty-blush4mo ago
@contributor help me please and I use useTable from @refined/core @kapa.ai
kapa.ai
kapa.ai4mo ago
Let me check the knowledge base for you. One moment! :books: Sorry @RomaY, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
ratty-blush
ratty-blush4mo ago
@contributor
sensitive-blue
sensitive-blue4mo ago
Hello @RomaY , can you provide us reproducible example for debug?
ratty-blush
ratty-blush4mo ago
Hello, I just saw the answer today. I have already converted to regular axios using useSearchParams and it works fine