Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Admin SPA: Fixed Zod v4 issues with resoruce table

Damian Legawiecf79969934bc1
diff --git a/packages/admin/src/components/resource-table.tsx b/packages/admin/src/components/resource-table.tsx
index 6f52b470a8..6974a38c0f 100644
--- a/packages/admin/src/components/resource-table.tsx
+++ b/packages/admin/src/components/resource-table.tsx
@@ -41,20 +41,25 @@ export const resourceSearchSchema = z.object({
sort: z.string().optional(),
dir: z.enum(['asc', 'desc']).optional(),
search: z.string().optional(),
- filters: z.preprocess((val) => {
- if (typeof val === 'string') {
- try {
- return JSON.parse(val)
- } catch {
- return []
+ filters: z
+ .preprocess((val) => {
+ if (typeof val === 'string') {
+ try {
+ return JSON.parse(val)
+ } catch {
+ return []
+ }
}
- }
- return val ?? []
- }, z.array(filterSchema).optional().default([])),
- columns: z.preprocess((val) => {
- if (typeof val === 'string') return val.split(',')
- return val ?? undefined
- }, z.array(z.string()).optional()),
+ return val ?? []
+ }, z.array(filterSchema))
+ .optional()
+ .default([]),
+ columns: z
+ .preprocess((val) => {
+ if (typeof val === 'string') return val.split(',')
+ return val
+ }, z.array(z.string()))
+ .optional(),
})
export type ResourceSearch = z.infer<typeof resourceSearchSchema>