import { invalidate, invalidateAll } from '$app/navigation';

/**
 * Invalidate dashboard data after mutations.
 * This triggers re-fetch of layout data that uses depends('app:dashboard').
 */
export async function invalidateDashboard() {
	await invalidate('app:dashboard');
}

/**
 * Invalidate account data after account-related mutations.
 * This triggers re-fetch of layout data that uses depends('app:accounts').
 */
export async function invalidateAccounts() {
	await invalidate('app:accounts');
}

/**
 * Invalidate all data - use sparingly.
 * Prefer targeted invalidation (invalidateDashboard, invalidateAccounts) when possible.
 */
export async function invalidateEverything() {
	await invalidateAll();
}
