diff --git a/tgui/packages/tgui/layouts/Window.tsx b/tgui/packages/tgui/layouts/Window.tsx index 9ae25c34f9f..abf35d8a311 100644 --- a/tgui/packages/tgui/layouts/Window.tsx +++ b/tgui/packages/tgui/layouts/Window.tsx @@ -50,36 +50,35 @@ export const Window = (props: Props) => { } = props; const { config, suspended } = useBackend(); - if (suspended) { - return; - } const { debugLayout = false } = useDebug(); useEffect(() => { - const updateGeometry = () => { - const options = { - ...config.window, - size: DEFAULT_SIZE, + if (!suspended) { + const updateGeometry = () => { + const options = { + ...config.window, + size: DEFAULT_SIZE, + }; + + if (width && height) { + options.size = [width, height]; + } + if (config.window?.key) { + setWindowKey(config.window.key); + } + recallWindowGeometry(options); }; - if (width && height) { - options.size = [width, height]; - } - if (config.window?.key) { - setWindowKey(config.window.key); - } - recallWindowGeometry(options); - }; + Byond.winset(Byond.windowId, { + 'can-close': Boolean(canClose), + }); + logger.log('mounting'); + updateGeometry(); - Byond.winset(Byond.windowId, { - 'can-close': Boolean(canClose), - }); - logger.log('mounting'); - updateGeometry(); - - return () => { - logger.log('unmounting'); - }; + return () => { + logger.log('unmounting'); + }; + } }, [width, height]); const dispatch = globalStore.dispatch; @@ -92,7 +91,7 @@ export const Window = (props: Props) => { ? config.status < UI_DISABLED : config.status < UI_INTERACTIVE); - return ( + return suspended ? null : ( =0)&&($[H]=Z[H]);return $}var w=(0,M.h)("Window"),N=[400,600],B=function(Z){var U,$=Z.canClose,X=$===void 0?!0:$,H=Z.theme,Y=Z.title,lt=Z.children,nt=Z.buttons,dt=Z.width,ct=Z.height,jt=(0,S.Oc)(),vt=jt.config,pt=jt.suspended;if(!pt){var Dt=(0,A.Lo)(),ce=Dt.debugLayout,fe=ce===void 0?!1:ce;(0,i.useEffect)(function(){var Ft=function(){var Bt,oe=F({},vt.window,{size:N});dt&&ct&&(oe.size=[dt,ct]),(Bt=vt.window)!=null&&Bt.key&&(0,b.y9)(vt.window.key),(0,b.C8)(oe)};return Byond.winset(Byond.windowId,{"can-close":!!X}),w.log("mounting"),Ft(),function(){w.log("unmounting")}},[dt,ct]);var Xt=S.J3.dispatch,It=(U=vt.window)==null?void 0:U.fancy,Mt=vt.user&&(vt.user.observer?vt.status=0)&&($[H]=Z[H]);return $}var w=(0,M.h)("Window"),N=[400,600],B=function(Z){var U,$=Z.canClose,X=$===void 0?!0:$,H=Z.theme,Y=Z.title,lt=Z.children,nt=Z.buttons,dt=Z.width,ct=Z.height,jt=(0,S.Oc)(),vt=jt.config,pt=jt.suspended,Dt=(0,A.Lo)(),ce=Dt.debugLayout,fe=ce===void 0?!1:ce;(0,i.useEffect)(function(){if(!pt){var Ft=function(){var Bt,oe=F({},vt.window,{size:N});dt&&ct&&(oe.size=[dt,ct]),(Bt=vt.window)!=null&&Bt.key&&(0,b.y9)(vt.window.key),(0,b.C8)(oe)};return Byond.winset(Byond.windowId,{"can-close":!!X}),w.log("mounting"),Ft(),function(){w.log("unmounting")}}},[dt,ct]);var Xt=S.J3.dispatch,It=(U=vt.window)==null?void 0:U.fancy,Mt=vt.user&&(vt.user.observer?vt.status=0)&&(X[V]=q[V]);return X}var D=(0,O.h)("Window"),S=[400,600],B=function(q){var Z,X=q.canClose,H=X===void 0?!0:X,V=q.theme,J=q.title,ce=q.children,le=q.buttons,fe=q.width,he=q.height,_e=(0,a.Oc)(),xe=_e.config,je=_e.suspended;if(!je){var Re=(0,v.Lo)(),qe=Re.debugLayout,Fe=qe===void 0?!1:qe;(0,t.useEffect)(function(){var mn=function(){var cn,En=M({},xe.window,{size:S});fe&&he&&(En.size=[fe,he]),(cn=xe.window)!=null&&cn.key&&(0,E.y9)(xe.window.key),(0,E.C8)(En)};return Byond.winset(Byond.windowId,{"can-close":!!H}),D.log("mounting"),mn(),function(){D.log("unmounting")}},[fe,he]);var Pe=a.J3.dispatch,He=(Z=xe.window)==null?void 0:Z.fancy,gn=xe.user&&(xe.user.observer?xe.status=0)&&(X[V]=q[V]);return X}var D=(0,O.h)("Window"),S=[400,600],B=function(q){var Z,X=q.canClose,H=X===void 0?!0:X,V=q.theme,J=q.title,ce=q.children,le=q.buttons,fe=q.width,he=q.height,_e=(0,a.Oc)(),xe=_e.config,je=_e.suspended,Re=(0,v.Lo)(),qe=Re.debugLayout,Fe=qe===void 0?!1:qe;(0,t.useEffect)(function(){if(!je){var mn=function(){var cn,En=M({},xe.window,{size:S});fe&&he&&(En.size=[fe,he]),(cn=xe.window)!=null&&cn.key&&(0,E.y9)(xe.window.key),(0,E.C8)(En)};return Byond.winset(Byond.windowId,{"can-close":!!H}),D.log("mounting"),mn(),function(){D.log("unmounting")}}},[fe,he]);var Pe=a.J3.dispatch,He=(Z=xe.window)==null?void 0:Z.fancy,gn=xe.user&&(xe.user.observer?xe.status