nytai commented on a change in pull request #13220:
URL: https://github.com/apache/superset/pull/13220#discussion_r578897372



##########
File path: superset-frontend/src/explore/components/ExploreViewContainer.jsx
##########
@@ -146,11 +147,11 @@ const getWindowSize = () => ({
 function useWindowSize({ delayMs = 250 } = {}) {
   const [size, setSize] = useState(getWindowSize());
 
-  useEffect(() => {
+  useComponentDidMount(() => {
     const onWindowResize = debounce(() => setSize(getWindowSize()), delayMs);
     window.addEventListener('resize', onWindowResize);
     return () => window.removeEventListener('resize', onWindowResize);
-  }, []);
+  });

Review comment:
       Right, and having the warnings thrown is a constant reminder to revisit 
some of that tech debt. Not every PR can be perfect the first time around. In 
the case of this change, 
https://github.com/apache/superset/pull/13220/files#diff-9c9be0048f0d0d4f1bd547faad9f8732fe5a12df6fc185190681914251131cc9R67
 I think the more correct behavior would be to add `infoEnable` and `resource` 
to the dependency array. It seems by applying your `useComponentDidMount` to 
that code in this PR, you are asserting that that the current behavior is 
correct.




----------------------------------------------------------------
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