From 073f9df8c813eb863486ca0994eb5423e2f3acf8 Mon Sep 17 00:00:00 2001 From: ferreo Date: Fri, 2 Aug 2024 20:33:17 +0100 Subject: [PATCH] Make the rebuild for errored src packages use the latest package version by default --- src/components/pages/errored.tsx | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/components/pages/errored.tsx b/src/components/pages/errored.tsx index 0a12ebb..ab906ea 100644 --- a/src/components/pages/errored.tsx +++ b/src/components/pages/errored.tsx @@ -65,15 +65,23 @@ const Errored: React.FC = () => { } }, [loadPackages]); - const handleRebuildClick = (pkg: any) => { + const handleRebuildClick = async (pkg: any) => { setSelectedPackage(pkg); - setRebuildData({ - packageName: pkg.Name, - version: pkg.BuildVersion, - buildType: "lto", - rebuild: false, + const packResp = await fetch("/api/package/" + pkg.Name, { + method: "GET", }); - setIsDialogOpen(true); + + const packData = await packResp.json(); + const firstPackage = packData.Packages[Object.keys(packData.Packages)[0]]; + if (packResp.ok) { + setRebuildData({ + packageName: pkg.Name, + version: firstPackage.NewVersion || firstPackage.Version, + buildType: "lto", + rebuild: false, + }); + setIsDialogOpen(true); + } }; const handleDialogSubmit = async () => {