refactor: make activate() read mana state from stores directly instead of requiring UI to pass gameState bag
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m28s

This commit is contained in:
2026-06-09 10:14:20 +02:00
parent 42053f41ac
commit c89d8fd2d8
5 changed files with 75 additions and 26 deletions
+6 -3
View File
@@ -85,16 +85,19 @@ export const DisciplinesTab: React.FC = () => {
const [activeAttunement, setActiveAttunement] = useState<string>('base');
const elements = useManaStore((s) => s.elements);
const rawMana = useManaStore((s) => s.rawMana);
const signedPacts = usePrestigeStore((s) => s.signedPacts);
// NOTE: activate() now reads rawMana/elements/signedPacts directly from the
// mana and prestige stores, so the UI only needs to pass the discipline id.
// This prevents the recurring bug where a missing field in a manually
// constructed gameState bag silently prevented reactivation.
const handleToggle = useCallback((id: string, paused: boolean) => {
if (paused) {
activate(id, { elements, rawMana, signedPacts });
activate(id);
} else {
deactivate(id);
}
}, [activate, deactivate, elements, rawMana, signedPacts]);
}, [activate, deactivate]);
const activeTab = ATTUNEMENT_TABS.find((t) => t.key === activeAttunement);