Rompe il ciclo di import rosa ↔ user-store
useGiocatoreCorrente (alias di useIo) passa da user-store a rosa: user-store non importa più rosa. Nessun cambio di comportamento. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cff78f941d
commit
4b5e7d91a1
3 files changed
+9
-8
No files matched your search
@@ -3,7 +3,7 @@ import { X } from "lucide-react";
|
|||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { useVotiSocial } from "@/lib/badge-social";
|
import { useVotiSocial } from "@/lib/badge-social";
|
||||||
import { useNotificheSmart } from "@/lib/notifiche-smart";
|
import { useNotificheSmart } from "@/lib/notifiche-smart";
|
||||||
import { useGiocatoreCorrente } from "@/lib/user-store";
|
import { useGiocatoreCorrente } from "@/lib/rosa";
|
||||||
import { coriandoli, useMotoRidotto } from "@/lib/motion";
|
import { coriandoli, useMotoRidotto } from "@/lib/motion";
|
||||||
|
|
||||||
const toni: Record<string, string> = {
|
const toni: Record<string, string> = {
|
||||||
|
|||||||
@@ -164,6 +164,14 @@ export function useIo(): Giocatore | null {
|
|||||||
return rosa.find((g) => g.id === id) ?? null;
|
return rosa.find((g) => g.id === id) ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Giocatore corrente con statistiche calcolate da dati reali (presenze, MVP, badge, …).
|
||||||
|
* Sta qui e non in `user-store` per non chiudere il ciclo `rosa` ↔ `user-store`.
|
||||||
|
*/
|
||||||
|
export function useGiocatoreCorrente(): Giocatore | null {
|
||||||
|
return useIo();
|
||||||
|
}
|
||||||
|
|
||||||
/** Obiettivi collaborativi calcolati sui dati reali già in cache. */
|
/** Obiettivi collaborativi calcolati sui dati reali già in cache. */
|
||||||
export function useObiettivi() {
|
export function useObiettivi() {
|
||||||
const rosa = useRosa();
|
const rosa = useRosa();
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
import { useSyncExternalStore } from "react";
|
import { useSyncExternalStore } from "react";
|
||||||
import type { Giocatore } from "./crapp-data";
|
|
||||||
import { isAllenatore, useGiocatoriSquadra, type GiocatoreSquadra } from "./giocatori-squadra";
|
import { isAllenatore, useGiocatoriSquadra, type GiocatoreSquadra } from "./giocatori-squadra";
|
||||||
import { useIo } from "./rosa";
|
|
||||||
|
|
||||||
const KEY = "crapp-user-v1";
|
const KEY = "crapp-user-v1";
|
||||||
const listeners = new Set<() => void>();
|
const listeners = new Set<() => void>();
|
||||||
@@ -72,8 +70,3 @@ export function useGiocatoreInCampo(): GiocatoreSquadra | null {
|
|||||||
const g = useGiocatoreBase();
|
const g = useGiocatoreBase();
|
||||||
return g && !isAllenatore(g) ? g : null;
|
return g && !isAllenatore(g) ? g : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Giocatore corrente con statistiche calcolate da dati reali (presenze, MVP, badge, …). */
|
|
||||||
export function useGiocatoreCorrente(): Giocatore | null {
|
|
||||||
return useIo();
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user