From 40b0d5fd3ab52f2c2e3f4bd245b45576ebced587 Mon Sep 17 00:00:00 2001 From: Nils-Johan Gynther Date: Sun, 19 Apr 2026 17:28:28 +0200 Subject: [PATCH] refactor(actions): return only serializable fields in product actions --- frontend/app/kvitto/actions.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/frontend/app/kvitto/actions.ts b/frontend/app/kvitto/actions.ts index de880fbc..8dd54740 100644 --- a/frontend/app/kvitto/actions.ts +++ b/frontend/app/kvitto/actions.ts @@ -20,7 +20,13 @@ export async function createProductAction(name: string) { throw new Error(e.message ?? `HTTP ${res.status}`); } - return res.json(); + const product = await res.json(); + // Return only serializable fields (Dates can't be serialized across RSC boundary) + return { + id: product.id, + name: product.name, + canonicalName: product.canonicalName, + }; } export async function updateProductCategoryAction(productId: number, categoryId: number) { @@ -37,5 +43,12 @@ export async function updateProductCategoryAction(productId: number, categoryId: throw new Error(e.message ?? `HTTP ${res.status}`); } - return res.json(); + const product = await res.json(); + // Return only serializable fields + return { + id: product.id, + name: product.name, + canonicalName: product.canonicalName, + categoryId: product.categoryId, + }; }