fix: gracefully skip widgets with unknown kind instead of crashing (#5915)

This commit is contained in:
Thomas authored and GitHub committed 2026-06-10 18:19:13 +02:00
1 parent b3cdab579b
commit 484b8cf9f1
1 file changed
+5 -3
+5 -3
View File
@@ -1604,7 +1604,8 @@ const getFullBoardWithWhereAsync = async (db: Database, where: SQL<unknown>, use
collapsed: collapseStates.at(0)?.collapsed ?? false, collapsed: collapseStates.at(0)?.collapsed ?? false,
}), }),
), ),
items: items.map(({ integrations: itemIntegrations, ...item }) => items: items
.map(({ integrations: itemIntegrations, ...item }) =>
parseItem({ parseItem({
...item, ...item,
layouts: item.layouts.map((layout) => ({ layouts: item.layouts.map((layout) => ({
@@ -1619,7 +1620,8 @@ const getFullBoardWithWhereAsync = async (db: Database, where: SQL<unknown>, use
advancedOptions: superjson.parse<BoardItemAdvancedOptions>(item.advancedOptions), advancedOptions: superjson.parse<BoardItemAdvancedOptions>(item.advancedOptions),
options: superjson.parse<Record<string, unknown>>(item.options), options: superjson.parse<Record<string, unknown>>(item.options),
}), }),
), )
.filter((item) => item !== null),
}; };
}; };
@@ -1635,7 +1637,7 @@ const parseItem = (item: unknown) => {
const result = outputItemSchema.safeParse(item); const result = outputItemSchema.safeParse(item);
if (!result.success) { if (!result.success) {
throw new Error(result.error.message); return null;
} }
return result.data; return result.data;
}; };