Skip to content

Open-source status page, incident response and uptime monitoring

fix: page-components update form (#1932)

Maximilian Kaskee255b5ae39c2
diff --git a/packages/api/src/router/pageComponent.ts b/packages/api/src/router/pageComponent.ts
index 084b3f272..79da6fb1e 100644
--- a/packages/api/src/router/pageComponent.ts
+++ b/packages/api/src/router/pageComponent.ts
@@ -385,9 +385,16 @@ export const pageComponentRouter = createTRPCRouter({
}
// Handle static components
- // If they have IDs, update them; otherwise insert new ones
+ // If they have a valid existing ID, update them; otherwise insert new ones
+ const existingComponentIds = new Set(
+ existingComponents.map((c) => c.id),
+ );
+
for (const componentValue of staticComponents) {
- if (componentValue.id) {
+ if (
+ componentValue.id &&
+ existingComponentIds.has(componentValue.id)
+ ) {
// Update existing static component (preserves ID and relationships)
await tx
.update(pageComponent)