[priority: 4] Main game component (page.tsx) has 12+ individual store subscriptions causing excessive re-renders #75
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: 4 — High
File:
src/app/page.tsx, lines 107-120Description:
The main
ManaLoopGamecomponent subscribes to 12+ different store slices individually:Every game tick updates
day/hour, causing this entire component (and all children) to re-render — even if nothing visible changed.Fix: Use
useShallowfrom Zustand for multi-field subscriptions, and push subscriptions down into child components that actually need them:Starting work on Issue 75: page.tsx has 12+ individual store subscriptions causing excessive re-renders. Using
useShallowfrom Zustand to combine multi-field subscriptions and reduce re-renders.Fixed: Used
useShallowfrom Zustand to combine multi-field store subscriptions inpage.tsx. Combinedday/hour/initGamefromuseGameStore,prestigeUpgrades/insight/loopInsightfromusePrestigeStore, andrawMana/meditateTicksfromuseManaStoreinto single subscriptions each. This reduces re-renders caused by individual field subscriptions.