fix: refactor store to direct $state exports + Object.assign mutation
All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 22s

Svelte 5 can't export reassigned $state — use const $state + Object.assign.
All components now import state/actions directly (no gameStore wrapper).
Deep reactivity works: evolutionTree nodes, generators, cosmetics all tracked.
This commit is contained in:
2026-03-28 20:23:57 +01:00
parent ce38975c10
commit 10ff2d32f5
16 changed files with 214 additions and 252 deletions

View File

@@ -1,5 +1,5 @@
<script lang="ts">
import { gameStore } from '$lib/stores/game.svelte';
import { state, getProductionPerSecond, getCurrentClickGain } from '$lib/stores/game.svelte';
import { formatNumber } from '$lib/utils/formatNumber';
</script>
@@ -7,23 +7,23 @@
<div class="grid grid-cols-5 gap-0.5 px-1">
<div class="gp-stat" title="Production automatique par seconde">
<span class="gp-label">Prod/s</span>
<span class="gp-value gp-accent-green text-[0.8rem]!">{formatNumber(gameStore.productionPerSecond)}</span>
<span class="gp-value gp-accent-green text-[0.8rem]!">{formatNumber(getProductionPerSecond())}</span>
</div>
<div class="gp-stat" title="Tetards gagnes par clic">
<span class="gp-label">/clic</span>
<span class="gp-value text-[0.8rem]!">{formatNumber(gameStore.getClickGain())}</span>
<span class="gp-value text-[0.8rem]!">{formatNumber(getCurrentClickGain())}</span>
</div>
<div class="gp-stat" title="Multiplicateur global (prestige)">
<span class="gp-label">Mult</span>
<span class="gp-value text-[0.8rem]!">x{gameStore.state.prestigeMultiplier.toFixed(1)}</span>
<span class="gp-value text-[0.8rem]!">x{state.prestigeMultiplier.toFixed(1)}</span>
</div>
<div class="gp-stat" title="ADN Ancestral">
<span class="gp-label">ADN</span>
<span class="gp-value gp-accent-purple text-[0.8rem]!">{gameStore.state.ancestralDna}</span>
<span class="gp-value gp-accent-purple text-[0.8rem]!">{state.ancestralDna}</span>
</div>
<div class="gp-stat" title="Nombre de prestiges">
<span class="gp-label">Gen.</span>
<span class="gp-value text-[0.8rem]!">{gameStore.state.prestigeCount}</span>
<span class="gp-value text-[0.8rem]!">{state.prestigeCount}</span>
</div>
</div>
</div>