Favourites
The teams and players you follow, three writes over them, and why the toasts stay with the mutations.
/favourites · src/composed/favourites
Two lists — teams and players — and three writes over them.
The toasts stay with the mutations
A toast is not markup. It is the acknowledgement of an action, fired from the same place that knows whether the action succeeded.
Moving them to the view would mean the composed returning a result the view then has to interpret — more wiring, and a boundary that does not correspond to anything. The rule this stands for: the state/view split is about who can reach the network, not about which lines happen to render.
Two caches have to be told
Every write revalidates through SWR's mutate and then calls the listener
manager, because the sidebar's favourite counts are rendered from a separate
subscription that does not share this cache.
That is a real seam and worth knowing before adding a fourth write: revalidating only the local key leaves the sidebar showing the old count until something else happens to refresh it, which reads as a bug in the sidebar rather than in the write.