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
Build and Publish Mana Loop Docker Image / build-and-publish (push) Successful in 1m28s
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user