rusackas commented on a change in pull request #11240:
URL: 
https://github.com/apache/incubator-superset/pull/11240#discussion_r505811949



##########
File path: superset-frontend/src/components/TableLoader.jsx
##########
@@ -68,43 +69,36 @@ class TableLoader extends React.PureComponent {
       addInfoToast,
       addSuccessToast,
       addWarningToast,
+      columns,
       ...tableProps
     } = this.props;
 
-    let { columns } = this.props;
-    if (!columns && this.state.data.length > 0) {
-      columns = Object.keys(this.state.data[0]).filter(col => col[0] !== '_');
-    }
+    const memoizedColumns = memoize((columns, data) => {

Review comment:
       Ahh... this may lead to issues (like the one that got reverted)!
   
   Lodash's memoize implementation only uses the first parameter of the 
function to cache bust.
   
   Here's [an article on 
it](https://dev.to/nioufe/you-should-not-use-lodash-for-memoization-3441) which 
illustrates the problem pretty well:
   
   
![image](https://user-images.githubusercontent.com/812905/96181041-363b7580-0ee8-11eb-88fb-a471a2dbfaa3.png)
   
   There are other issues they point out too (bloating infinite cache) but in 
any case, the recommendation of the React docs is to use `memoize-one` instead.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to