onColumnFiltersChange sees custom state update function as an empty function #4214
-
Hi, I am using manual filtering and I am encountering a weird issue.
My component structure looks like this:
In my VirtualizedTable component I have a Toolbar that I render and inside it has a component that filters the table and calls This all works fine. My issue is the following. I found that the performance wasn't good when my toolbar was inside my VirtualizedTable component, so I decided to take it out and put it instead above my right under the main .
When I did so, without any changes to my code, the table would no longer filter. When I put it back inside the component, it works normally. I can't figure out what is different. I tried to create a ref to my function and use that to be called when the onColumnFiltersChange is triggered and that did the same results. Hope you can shed some light on what I could look at. Thanks! Sorry if I am unclear. Oh and I am using latest version release. Update: I did the following test
For some reason the output is:
In this scenario, I commented both rendering of my toolbar and table and simply rendered a button in the same page as my instance of the table. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Ok I figured out what the issue was, it seems it was caused by I commented it and the console.log was working as usual. I had to remove it and refactor the way I am refetching my query based on the changes. |
Beta Was this translation helpful? Give feedback.
Ok I figured out what the issue was, it seems it was caused by
refetch
inside mysetColumnFilters
. I have no idea why this would break the whole thing. Myrefetch
function comes from @apollo/client.I commented it and the console.log was working as usual.
I have no idea why in my sub-component, it did not have this impact but outside it did.
I had to remove it and refactor the way I am refetching my query based on the changes.
But this is an odd behavior.