From 39b20abd2ec7792f4a4a6018af9f3e8050e2dc63 Mon Sep 17 00:00:00 2001 From: Iajret <8430839+Iajret@users.noreply.github.com> Date: Sun, 7 Jan 2024 17:35:03 +0300 Subject: [PATCH] Hotfix for paper tgui crash (#1490) Co-authored-by: loanselot <63502313+exdal@users.noreply.github.com> --- tgui/packages/tgui/interfaces/Biogenerator.tsx | 4 ++-- tgui/packages/tgui/interfaces/PaperSheet.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tgui/packages/tgui/interfaces/Biogenerator.tsx b/tgui/packages/tgui/interfaces/Biogenerator.tsx index 45e63c67b89..c0ab89b16b4 100644 --- a/tgui/packages/tgui/interfaces/Biogenerator.tsx +++ b/tgui/packages/tgui/interfaces/Biogenerator.tsx @@ -1,6 +1,5 @@ import { BooleanLike } from 'common/react'; import { classes } from 'common/react'; -import { useState } from 'react'; import { useBackend, useLocalState } from '../backend'; import { @@ -185,7 +184,8 @@ export const Biogenerator = (props) => { const ItemList = (props) => { const { act } = useBackend(); const items = props.items.map((item) => { - const [amount, setAmount] = useState( + const [amount, setAmount] = useLocalState( + 'amount' + item.name, item.is_reagent ? Math.min(Math.max(props.space, 1), 10) : 1, ); const disabled = diff --git a/tgui/packages/tgui/interfaces/PaperSheet.tsx b/tgui/packages/tgui/interfaces/PaperSheet.tsx index cde38fa9694..5e239d79c76 100644 --- a/tgui/packages/tgui/interfaces/PaperSheet.tsx +++ b/tgui/packages/tgui/interfaces/PaperSheet.tsx @@ -5,7 +5,7 @@ import { clamp } from 'common/math'; import { classes } from 'common/react'; import { marked } from 'marked'; -import { Component, createRef, RefObject, useState } from 'react'; +import { Component, createRef, RefObject } from 'react'; import { useBackend, useLocalState } from '../backend'; import { Box, Button, Flex, Section, TextArea } from '../components'; @@ -315,7 +315,7 @@ export class PrimaryView extends Component { {}, ); - const [textAreaText, setTextAreaText] = useState(''); + const [textAreaText, setTextAreaText] = useLocalState('textAreaText', ''); const interactMode = held_item_details?.interaction_mode || InteractionType.reading;