state debug

This commit is contained in:
HF 2022-08-14 21:51:30 +02:00
parent 70e1e156a6
commit 2f1a60fce7

View File

@ -14,11 +14,21 @@ import {
// eslint-disable-next-line max-len
const selectWindowIds = (state) => state.windows.windows.map((win) => win.windowId);
// eslint-disable-next-line max-len
const selectMeta = (state) => [state.windows.showWindows, state.windows.someFullscreen];
const selectMeta = (state) => {
console.log('check');
return [
state.windows.showWindows,
state.windows.someFullscreen,
state.windows.windows.some((win) => win.fullscreen && win.open && !win.hidden),
]};
const WindowManager = () => {
const windowIds = useSelector(selectWindowIds, shallowEqual);
const [showWindows, someFullscreen] = useSelector(selectMeta, shallowEqual);
const [
showWindows,
someFullscreen,
someOpenFullscreen,
] = useSelector(selectMeta, shallowEqual);
const dispatch = useDispatch();
if ((!showWindows && !someFullscreen) || !windowIds.length) {
@ -28,7 +38,7 @@ const WindowManager = () => {
return (
<div id="wm">
<Overlay
show={someFullscreen}
show={someOpenFullscreen}
onClick={() => dispatch(closeFullscreenWindows())}
/>
{windowIds.map((id) => <Window key={id} id={id} />)}