Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

656 B
Raw Blame
import { fireAndForget } from '@core/util/fireAndForget';
import { invalidateDatabase } from '@queries/storage/databases';
import { useEntitySubscription } from '@service-connection/client';

/**
 * Share gateway tracking and catch up on subscription, reconnect and refocus.
 * Live write notifications reach the source through useDatabaseTableChanges.
 */
export function useDatabaseSubscription(
  databaseId: string,
  refreshRows: () => void
) {
  useEntitySubscription(
    () => ({ entity_type: 'database', entity_id: databaseId }),
    () => {
      fireAndForget(invalidateDatabase(databaseId), 'database-cache');
      refreshRows();
    }
  );
}