diff --git a/src/DevMenu.tsx b/src/DevMenu.tsx
index 291be09d3..1072dff21 100644
--- a/src/DevMenu.tsx
+++ b/src/DevMenu.tsx
@@ -27,19 +27,23 @@ import { AchievementsDev } from "./DevMenu/ui/AchievementsDev";
import { EntropyDev } from "./DevMenu/ui/EntropyDev";
import { Exploit } from "./Exploits/Exploit";
+import { useRerender } from "./ui/React/hooks";
export function DevMenuRoot(): React.ReactElement {
useEffect(() => {
Player.giveExploit(Exploit.YoureNotMeantToAccessThis);
}, []);
+ // Pass rerender to certain subpages in case certain tabs are now valid/invalid due to changes made on those pages
+ // Rerender periodically in case game state changes (e.g. player starts gang or buys wse account through a script)
+ const rerender = useRerender(400);
return (
<>
Development Menu - Only meant to be used for testing/debugging
-
+
-
+
diff --git a/src/DevMenu/ui/General.tsx b/src/DevMenu/ui/General.tsx
index 8f70c150f..a3e5b8101 100644
--- a/src/DevMenu/ui/General.tsx
+++ b/src/DevMenu/ui/General.tsx
@@ -23,11 +23,10 @@ import { Page } from "../../ui/Router";
import { Bladeburner } from "../../Bladeburner/Bladeburner";
import { GangConstants } from "../../Gang/data/Constants";
import { checkForMessagesToSend } from "../../Message/MessageHelpers";
-import { ThemeEvents } from "../../Themes/ui/Theme";
import { getEnumHelper } from "../../utils/EnumHelper";
import { formatRam } from "../../ui/formatNumber";
-export function General(): React.ReactElement {
+export function General({ parentRerender }: { parentRerender: () => void }): React.ReactElement {
const rerender = useRerender(400);
const [error, setError] = useState(false);
const [corporationName, setCorporationName] = useState("");
@@ -64,38 +63,32 @@ export function General(): React.ReactElement {
// Corp functions
const createCorporation = () => {
Player.startCorporation(corporationName, false);
- // Rerender so the corp menu option will show up immediately on the devmenu page selection
- ThemeEvents.emit();
+ parentRerender();
};
const destroyCorporation = () => {
Player.corporation = null;
- // Rerender so the corp menu option will be removed immediately on the devmenu page selection
- ThemeEvents.emit();
+ parentRerender();
};
// Blade functions
const joinBladeburner = () => {
Player.bladeburner = new Bladeburner();
- // Rerender so the blade menu option will show up immediately on the devmenu page selection
- ThemeEvents.emit();
+ parentRerender();
};
const leaveBladeburner = () => {
Player.bladeburner = null;
- // Rerender so the blade menu option will be removed immediately on the devmenu page selection
- ThemeEvents.emit();
+ parentRerender();
};
// Gang functions
const startGang = () => {
const isHacking = gangFaction === FactionName.NiteSec || gangFaction === FactionName.TheBlackHand;
Player.startGang(gangFaction, isHacking);
- // Rerender so the gang menu option will show up immediately on the devmenu page selection
- ThemeEvents.emit();
+ parentRerender();
};
const stopGang = () => {
Player.gang = null;
- // Rerender so the gang menu option will be removed immediately on the devmenu page selection
- ThemeEvents.emit();
+ parentRerender();
};
const setGangFactionDropdown = (event: SelectChangeEvent) => {
// Todo: Make this a more specific check when a GangName enumlike is added
diff --git a/src/DevMenu/ui/SleevesDev.tsx b/src/DevMenu/ui/SleevesDev.tsx
index 66eb1bfd2..19dbad80e 100644
--- a/src/DevMenu/ui/SleevesDev.tsx
+++ b/src/DevMenu/ui/SleevesDev.tsx
@@ -71,6 +71,11 @@ export function SleevesDev(): React.ReactElement {
+