useRefreshSubscriptions

Re-issue every live subscription after the connection's subject changes — no reload, no reconnect.

When a user signs in, the server rebinds the subject on the existing connection. Every open subscription is now snapshotting against the wrong subject's tenant scope. Reloading the page would fix it and lose everything else; this hook is the surgical version.

import { useRefreshSubscriptions } from '@voltro/client'

const refresh = useRefreshSubscriptions('app')
await signIn(...)
refresh()

It returns a stable zero-argument function. Calling it interrupts each active subscription's fiber and re-forks it over the same WebSocket — no reconnect. Server-side each one is a fresh subscription, so it flows through the auth middleware again and resolves the new subject.

Optimistic patches survive the refresh: they are tied to mutation lifecycles, not subscription lifecycles, and the new snapshots land underneath them.

The data does not — each entry's rows are cleared and the components go back to loading until their new snapshot arrives. That is deliberate: the whole reason to call this is that the identity changed, and the new subject may be entitled to strictly less than the old one. It is the same boundary that stops a reconnect from seeding across a useReconnect() — a dropped connection keeps your screen, a change of identity clears it.

This is not a cache-invalidation tool. Subscriptions are already live, so a normal write needs no refresh — reach for this only when the connection's identity changed underneath them.