mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 01:53:48 +01:00
actual fix for the reseting of limit, need to reset modal internal state
This commit is contained in:
parent
9e39ca32a5
commit
8d56c41dd6
@ -1,4 +1,4 @@
|
||||
import React, { useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { LimitMaterialProduction } from "../../Actions";
|
||||
import { Modal } from "../../../ui/React/Modal";
|
||||
import Typography from "@mui/material/Typography";
|
||||
@ -17,6 +17,13 @@ interface IProps {
|
||||
export function LimitMaterialProductionModal(props: IProps): React.ReactElement {
|
||||
const [limit, setLimit] = useState<number | null>(null);
|
||||
|
||||
// reset modal internal state on modal close
|
||||
useEffect(() => {
|
||||
if (!props.open) {
|
||||
setLimit(null);
|
||||
}
|
||||
}, [props.open]);
|
||||
|
||||
function limitMaterialProduction(): void {
|
||||
let qty = limit;
|
||||
if (qty === null) qty = -1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useState } from "react";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { Product } from "../../Product";
|
||||
import { LimitProductProduction } from "../../Actions";
|
||||
import { Modal } from "../../../ui/React/Modal";
|
||||
@ -18,6 +18,13 @@ interface IProps {
|
||||
export function LimitProductProductionModal(props: IProps): React.ReactElement {
|
||||
const [limit, setLimit] = useState<number | null>(null);
|
||||
|
||||
// reset modal internal state on modal close
|
||||
useEffect(() => {
|
||||
if (!props.open) {
|
||||
setLimit(null);
|
||||
}
|
||||
}, [props.open]);
|
||||
|
||||
function limitProductProduction(): void {
|
||||
let qty = limit;
|
||||
if (qty === null) qty = -1;
|
||||
|
Loading…
Reference in New Issue
Block a user