feat(frontend): add depends('app:document') to enrich load for targeted invalidation after file upload
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,11 +6,13 @@ import { getErrorMessage, parseBackendError } from '$lib/errors';
|
||||
export async function load({
|
||||
params,
|
||||
fetch,
|
||||
locals
|
||||
locals,
|
||||
depends
|
||||
}: {
|
||||
params: { id: string };
|
||||
fetch: typeof globalThis.fetch;
|
||||
locals: App.Locals;
|
||||
depends: (dep: string) => void;
|
||||
}) {
|
||||
const canWrite =
|
||||
locals.user?.groups?.some((g: { permissions: string[] }) =>
|
||||
@@ -18,6 +20,8 @@ export async function load({
|
||||
) ?? false;
|
||||
if (!canWrite) throw redirect(303, '/');
|
||||
|
||||
depends('app:document');
|
||||
|
||||
const { id } = params;
|
||||
const api = createApiClient(fetch);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user