mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 08:42:53 +02:00
UI: Sync UI updates to game updates. (#1512)
There are a bunch of React components that update at the same rate that the game engine processes cycles. Rather than have each place that does so start its own timer to update that often, add a new react hook that triggers an update shortly after the engine completes a cycle.
This commit is contained in:
@@ -11,12 +11,12 @@ import { Settings } from "../../Settings/Settings";
|
||||
|
||||
import { Programs } from "../Programs";
|
||||
import { CreateProgramWork, isCreateProgramWork } from "../../Work/CreateProgramWork";
|
||||
import { useRerender } from "../../ui/React/hooks";
|
||||
import { useCycleRerender } from "../../ui/React/hooks";
|
||||
|
||||
export const ProgramsSeen = new Set<string>();
|
||||
|
||||
export function ProgramsRoot(): React.ReactElement {
|
||||
useRerender(200);
|
||||
useCycleRerender();
|
||||
|
||||
const programs = [...Object.values(Programs)]
|
||||
.filter((prog) => {
|
||||
|
||||
Reference in New Issue
Block a user