title: useEffect cleaning function is not called when tab is closed
body: <p>I have this useEffect which I use just for cleaning:</p>
  
  <pre><code>  useEffect(() =&gt; {
      return function cleanup() {
        if (!room || !currentPortal) return;
        leavePortal(
          room,
          currentPortal,
          currentUserProfile &amp;&amp; currentUserProfile.uid
            ? currentUserProfile.uid
            : uniqueId
        );
        detachListener();
      };
    }, [isFirstLoad, currentUserProfile, currentPortal]);
  </code></pre>
  
  <p>I can go back and forth and it works just fine, but does nothing if the tab is closed. Is that how useEffect works? Does it not detect the tab closing?</p>