diff --git a/src/Locations/ui/CoresButton.tsx b/src/Locations/ui/CoresButton.tsx
index 9e0c082f4..563bcb556 100644
--- a/src/Locations/ui/CoresButton.tsx
+++ b/src/Locations/ui/CoresButton.tsx
@@ -14,16 +14,18 @@ interface IProps {
export function CoresButton(props: IProps): React.ReactElement {
const homeComputer = Player.getHomeComputer();
- const maxCores = Player.bitNodeOptions.restrictHomePCUpgrade || homeComputer.cpuCores >= 8;
- if (maxCores) {
- return ;
- }
+ const reachMaxCore = Player.bitNodeOptions.restrictHomePCUpgrade || homeComputer.cpuCores >= 8;
const cost = Player.getUpgradeHomeCoresCost();
function buy(): void {
- if (maxCores) return;
- if (!Player.canAfford(cost)) return;
+ // Do NOT reuse reachMaxCore - it is cached (and possibly stale) at button creation time
+ if (Player.bitNodeOptions.restrictHomePCUpgrade || homeComputer.cpuCores >= 8) {
+ return;
+ }
+ if (!Player.canAfford(cost)) {
+ return;
+ }
Player.loseMoney(cost, "servers");
homeComputer.cpuCores++;
props.rerender();
@@ -37,9 +39,16 @@ export function CoresButton(props: IProps): React.ReactElement {
"Cores increase the effectiveness of grow() and weaken() on 'home'"
-