fix: address performance review feedback

This commit is contained in:
ajnart committed 2026-07-29 06:50:13 +02:00
1 parent 7266e15356
commit 0b9c4d6375
8 files changed
+42 -12

No files matched your search

@@ -1,7 +1,7 @@
import { Suspense } from "react";
import { notFound } from "next/navigation";
import { Center } from "@mantine/core";
import { Center, Loader } from "@mantine/core";
import { env } from "@homarr/common/env";
import { db } from "@homarr/db";
import type { WidgetKind } from "@homarr/definitions";
import { widgetKinds } from "@homarr/widgets/manifest";
@@ -13,7 +13,8 @@ interface Props {
}
export default async function WidgetPreview(props: Props) {
if (!(widgetKinds.includes((await props.params).kind as WidgetKind) || env.NODE_ENV !== "development")) {
const { kind } = await props.params;
if (!widgetKinds.includes(kind as WidgetKind)) {
notFound();
}
@@ -26,11 +27,11 @@ export default async function WidgetPreview(props: Props) {
},
});
const sort = (await props.params).kind as WidgetKind;
return (
<Center h="100vh">
<WidgetPreviewPageContent kind={sort} integrationData={integrationData} />
<Suspense fallback={<Loader size="sm" />}>
<WidgetPreviewPageContent kind={kind as WidgetKind} integrationData={integrationData} />
</Suspense>
</Center>
);
}
@@ -136,7 +136,7 @@ export const IntegrationMultiSelectGrid = ({
);
})}
{filtered.length === 0 && (
{!isPending && filtered.length === 0 && (
<Center p="xl">
<Text c="dimmed">{t("common.noResults")}</Text>
</Center>
@@ -89,7 +89,7 @@ export const IntegrationSelectGrid = ({ onSelect, enableMockIntegration = false
</Card>
))}
{filtered.length === 0 && (
{!isPending && filtered.length === 0 && (
<Center p="xl">
<Text c="dimmed">{t("common.noResults")}</Text>
</Center>