From d3f110bade48ea724dd4bcfb55b73037cc336db9 Mon Sep 17 00:00:00 2001 From: Jeremiah <42397676+jlsnow301@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:12:42 -0800 Subject: [PATCH] Fixes pod launcher BSOD [no gbp] (#80857) ## About The Pull Request This fixes an issue caused by a class component and a pseudo hook called useState. The screen works now. It's also terribly overdue for a refactor, which I'm working on after looking at it. As a general rule I think tgui interfaces should keep it under 500 lines. This one is 1203. I want to fix it before I do anything else to it for file diff reasons. ## Why It's Good For The Game Fixes #80850 ## Changelog :cl: admin: Fixed the bluescreen in the centcom pod launcher. /:cl: --- tgui/packages/tgui/interfaces/CentcomPodLauncher.jsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tgui/packages/tgui/interfaces/CentcomPodLauncher.jsx b/tgui/packages/tgui/interfaces/CentcomPodLauncher.jsx index 34dd4b36261..9b53499f046 100644 --- a/tgui/packages/tgui/interfaces/CentcomPodLauncher.jsx +++ b/tgui/packages/tgui/interfaces/CentcomPodLauncher.jsx @@ -3,7 +3,7 @@ import { classes } from 'common/react'; import { storage } from 'common/storage'; import { multiline } from 'common/string'; import { createUuid } from 'common/uuid'; -import { Component, Fragment, useState } from 'react'; +import { Component, Fragment } from 'react'; import { useBackend, useLocalState } from '../backend'; import { @@ -25,7 +25,7 @@ const pod_grey = { }; const useCompact = () => { - const [compact, setCompact] = useState(false); + const [compact, setCompact] = useLocalState('compact', false); const toggleCompact = () => setCompact(!compact); return [compact, toggleCompact]; }; @@ -830,10 +830,10 @@ class PresetsPage extends Component { render() { const { presets } = this.state; const { act, data } = useBackend(); - const [presetIndex, setSelectedPreset] = useState(0); - const [settingName, setEditingNameStatus] = useState(0); - const [newNameText, setText] = useState(''); - const [hue, setHue] = useState(0); + const [presetIndex, setSelectedPreset] = useLocalState('presetIdx', 0); + const [settingName, setEditingNameStatus] = useLocalState('settingName', 0); + const [newNameText, setText] = useLocalState('nameText', ''); + const [hue, setHue] = useLocalState('hue', 0); return (