feat: add revalidation for QuickStack version cache before update

This commit is contained in:
biersoeckli
2025-12-29 10:24:04 +00:00
parent 7569d646be
commit 6a7094e157
2 changed files with 8 additions and 3 deletions

View File

@@ -106,11 +106,15 @@ export const cleanupOldBuildJobs = async () =>
return new SuccessActionResult(undefined, 'Successfully cleaned up old build jobs.');
});
export const revalidateQuickStackVersionCache = async () =>
simpleAction(async () => {
revalidateTag(Tags.quickStackVersionInfo()); // separated because updateFunction restarts backend wich results in error
});
export const updateQuickstack = async () =>
simpleAction(async () => {
await getAdminUserSession();
const useCaranyChannel = await paramService.getBoolean(ParamService.USE_CANARY_CHANNEL, false);
revalidateTag(Tags.quickStackVersionInfo());
await quickStackService.updateQuickStack(useCaranyChannel);
return new SuccessActionResult(undefined, 'QuickStack will be updated, refresh the page in a few seconds.');
});

View File

@@ -1,7 +1,7 @@
'use client';
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
import { setCanaryChannel, updateQuickstack } from "./actions";
import { revalidateQuickStackVersionCache, setCanaryChannel, updateQuickstack } from "./actions";
import { Button } from "@/components/ui/button";
import { Toast } from "@/frontend/utils/toast.utils";
import { useConfirmDialog } from "@/frontend/states/zustand.states";
@@ -31,7 +31,8 @@ export default function QuickStackVersionInfo({
description: 'This action will restart the QuickStack service and installs the latest version. It may take a few minutes to complete.',
okButton: "Update QuickStack",
})) {
Toast.fromAction(() => updateQuickstack());
await revalidateQuickStackVersionCache(); // separated because updateFunction restarts backend wich results in error
await Toast.fromAction(() => updateQuickstack());
}
};