Skip to content

[AnalyticalTable] How to get updated length of table's filtered rows? #6573

Closed Answered by ThiagoSzz
ThiagoSzz asked this question in Q&A
Discussion options

You must be logged in to vote

After some investigation, I found that the issue was in the useControlledState that I was passing to the reactTableOptions prop, that was being triggered due to the dependency that I set in the useEffect:

const useControlledState = (state: any) => {
  useEffect(() => {
    if (state.filters.length > 0) {
      doSomethingWithFilters(state.filters);
    }
  }, [state.filters]);

  return useMemo(() => state, [state]);
};

This caused the doSomethingWithFilters() function to be called everytime the value of a filter was updated, triggering the mentioned React error. To solve this, I've simply added a debounce before calling the function:

const debounceFilters = useRef(
  debounce((filters: any)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Lukas742
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant