Uncaught Invariant Violation when implementing standard sorting example
Hi, I installed "react-table" today (version ^7.0.0-rc.15) and am trying to implement a table with Material-UI styling (copied from example) and sorting (also copied from example). When I run the app and click on a table header column, I get the following error: "react-dom.development.js:24489 Uncaught Invariant Violation: Maximum update depth exceeded."
Below is the code. Is this a bug or am I missing something?

Just as a random data point, we have been using the react-table 7.0.0 release candidates in our application, and sorting stopped working at some point recently. I don't get as far as you do... there is just no onclick handler returned to me from column.getSortByToggleProps(). Quite possible that I'm just doing something wrong. Still investigating.
But, possibly there have been some rumblings in the sorting code.
Short update: Tried a couple of different version combinations but none resolved the issue React 16.9.0 + material-table version 7.0.0-rc.15 (original setup): Uncaught Invariant Violation thrown React 16.12.0 + material-table version 7.0.0-rc.15: Uncaught Invariant Violation thrown React 16.12.0 + material-table version 7.0.0-rc.0: Uncaught Invariant Violation thrown
The very basic combination of material UI example and sortBy seem to work for me: https://codesandbox.io/s/epic-banach-9jmvu
What you can try is to try debugging your code by replacing parts with static data: for example, replace data and columns with some static array and object and see if that would work.
One possibility is that either data is not memoized, or it is (or columns, if the className returned from the useStyles) changed between renders.
But yeah, the best way to debug is to try and delete the code until things would work — as the minimal composition of examples works, then using it and then gradually adding your parts would allow to see what goes wrong.
And if you would be able to catch the minimal reproducible case, it would be great if you would be able to put it on CodeSandbox for further debugging.
Thank you very much @kizu, that did the job!
I changed line
const data: ISurveyDetails = getPagedResults(surveyDetails, page, resultsPerPage, FIRST_PAGE);
to
const data: ISurveyDetails = useMemo(() => getPagedResults(surveyDetails, page, resultsPerPage, FIRST_PAGE), [surveyDetails, page, resultsPerPage]);
and the column sorting is now working correctly :)