import type { ListEventType } from '@superlist/shared' import type { QueryKey } from '@tanstack/react-query' /** Every event type the SSE stream can emit, in one place for the client. */ export const LIST_EVENT_TYPES: readonly ListEventType[] = [ 'item.created', 'item.updated', 'invitation.created', 'member.added', 'list.updated', ] /** * Query keys a list event invalidates. Item changes only touch the item list; * membership and invitation changes refresh the list detail and the overview * (whose summary carries `memberCount`). */ export function queryKeysForListEvent(type: ListEventType, listId: string): QueryKey[] { switch (type) { case 'item.created': case 'item.updated': return [['lists', listId, 'items']] case 'invitation.created': case 'member.added': case 'list.updated': return [['lists', listId], ['lists']] } }