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({
|
export async function load({
|
||||||
params,
|
params,
|
||||||
fetch,
|
fetch,
|
||||||
locals
|
locals,
|
||||||
|
depends
|
||||||
}: {
|
}: {
|
||||||
params: { id: string };
|
params: { id: string };
|
||||||
fetch: typeof globalThis.fetch;
|
fetch: typeof globalThis.fetch;
|
||||||
locals: App.Locals;
|
locals: App.Locals;
|
||||||
|
depends: (dep: string) => void;
|
||||||
}) {
|
}) {
|
||||||
const canWrite =
|
const canWrite =
|
||||||
locals.user?.groups?.some((g: { permissions: string[] }) =>
|
locals.user?.groups?.some((g: { permissions: string[] }) =>
|
||||||
@@ -18,6 +20,8 @@ export async function load({
|
|||||||
) ?? false;
|
) ?? false;
|
||||||
if (!canWrite) throw redirect(303, '/');
|
if (!canWrite) throw redirect(303, '/');
|
||||||
|
|
||||||
|
depends('app:document');
|
||||||
|
|
||||||
const { id } = params;
|
const { id } = params;
|
||||||
const api = createApiClient(fetch);
|
const api = createApiClient(fetch);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user