Skip to content

Commit

Permalink
Remove fullscreen mode when workpad unmounts (#114551)
Browse files Browse the repository at this point in the history
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
Corey Robertson and kibanamachine authored Nov 2, 2021
1 parent 98de5f6 commit 39d79f7
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/
import { useContext, useEffect } from 'react';
import useEffectOnce from 'react-use/lib/useEffectOnce';
import { usePlatformService } from '../../../services';
import { WorkpadRoutingContext } from '..';

Expand All @@ -27,4 +28,10 @@ export const useFullscreenPresentationHelper = () => {
setFullscreen(true);
}
}, [isFullscreen, setFullscreen]);

// Remove fullscreen when component unmounts
useEffectOnce(() => () => {
setFullscreen(true);
document.querySelector('body')?.classList.remove(fullscreenClass);
});
};

0 comments on commit 39d79f7

Please sign in to comment.