useStoreSubscriptions

function
devtools-ui/src/hooks/useStoreSubscriptions.ts:64
signature
useStoreSubscriptions(storeId): { data: null | SubscriptionData; loading: boolean; refresh: () => void }

Fetches and caches subscription/consumer info for a store.

Parameters

NameTypeDescription
storeIdnull | stringThe store ID to query, or null to disable.

Returns

{ data: null | SubscriptionData; loading: boolean; refresh: () => void }, An object with data (SubscriptionData or null), loading, and refresh.

Example

example
import { useStoreSubscriptions } from "@yoltra/devtools-ui";

function SubscriptionPanel({ storeId }: { storeId: string }) {
  const { data, loading, refresh } = useStoreSubscriptions(storeId);
  if (loading || !data) return <p>Loading...</p>;
  return (
    <div>
      <p>Atomic: {data.atomic.length}</p>
      <p>Event: {data.event.length}</p>
      <button onClick={refresh}>Refresh</button>
    </div>
  );
}