fix: new errors detected through the app (#8629)

This commit is contained in:
Alejandro Bailo
2025-09-02 12:35:06 +02:00
committed by GitHub
parent 230a085c76
commit 3ded224a4b
3 changed files with 26 additions and 13 deletions
+2 -2
View File
@@ -48,8 +48,8 @@ export const getComplianceOverviewMetadataInfo = async ({
if (sort) url.searchParams.append("sort", sort);
Object.entries(filters).forEach(([key, value]) => {
// Define filters to exclude
if (key !== "filter[search]") {
// Define filters to exclude and check for valid values
if (key !== "filter[search]" && value && String(value).trim() !== "") {
url.searchParams.append(key, String(value));
}
});
+17 -11
View File
@@ -91,12 +91,14 @@ export default async function Compliance({
}
: undefined;
const metadataInfoData = await getComplianceOverviewMetadataInfo({
query,
filters: {
"filter[scan_id]": selectedScanId,
},
});
const metadataInfoData = selectedScanId
? await getComplianceOverviewMetadataInfo({
query,
filters: {
"filter[scan_id]": selectedScanId,
},
})
: { data: { attributes: { regions: [] } } };
const uniqueRegions = metadataInfoData?.data?.attributes?.regions || [];
@@ -140,11 +142,15 @@ const SSRComplianceGrid = async ({
// Extract query from filters
const query = (filters["filter[search]"] as string) || "";
const compliancesData = await getCompliancesOverview({
scanId,
region: regionFilter,
query,
});
// Only fetch compliance data if we have a valid scanId
const compliancesData =
scanId && scanId.trim() !== ""
? await getCompliancesOverview({
scanId,
region: regionFilter,
query,
})
: { data: [], errors: [] };
const type = compliancesData?.data?.type;
+7
View File
@@ -1,3 +1,5 @@
import { redirect } from "next/navigation";
import { getLighthouseConfig } from "@/actions/lighthouse/lighthouse";
import { LighthouseIcon } from "@/components/icons/Icons";
import { Chat } from "@/components/lighthouse";
@@ -7,6 +9,11 @@ export default async function AIChatbot() {
const lighthouseConfig = await getLighthouseConfig();
const hasConfig = !!lighthouseConfig;
if (!hasConfig) {
return redirect("/lighthouse/config");
}
const isActive = lighthouseConfig.is_active ?? false;
return (