From 9c7377e8ca093cb647dde9363eb476a5537f2c01 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Mon, 5 Jan 2026 21:03:57 +0100 Subject: [PATCH] fix: dependent api calls --- .../modules/backups/routes/restore-snapshot.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/client/modules/backups/routes/restore-snapshot.tsx b/app/client/modules/backups/routes/restore-snapshot.tsx index 4164df15..8304c0c0 100644 --- a/app/client/modules/backups/routes/restore-snapshot.tsx +++ b/app/client/modules/backups/routes/restore-snapshot.tsx @@ -23,13 +23,20 @@ export function meta({ params }: Route.MetaArgs) { } export const clientLoader = async ({ params }: Route.ClientLoaderArgs) => { - const [schedule, snapshot, repository] = await Promise.all([ - getBackupSchedule({ path: { scheduleId: params.id } }), - getSnapshotDetails({ path: { id: params.id, snapshotId: params.snapshotId } }), - getRepository({ path: { id: params.id } }), - ]); + const schedule = await getBackupSchedule({ path: { scheduleId: params.id } }); if (!schedule.data) return redirect("/backups"); + + const [snapshot, repository] = await Promise.all([ + getSnapshotDetails({ + path: { + id: schedule.data.repositoryId, + snapshotId: params.snapshotId, + }, + }), + getRepository({ path: { id: schedule.data.repositoryId } }), + ]); + if (!snapshot.data) return redirect(`/backups/${params.id}`); if (!repository.data) return redirect(`/backups/${params.id}`);