diff --git a/.changeset/slotted-page-no-slots-required.md b/.changeset/slotted-page-no-slots-required.md new file mode 100644 index 0000000000..de9f6514f2 --- /dev/null +++ b/.changeset/slotted-page-no-slots-required.md @@ -0,0 +1,12 @@ +--- +"@objectstack/spec": patch +--- + +fix(spec): don't require `slots` on slotted pages + +`PageSchema`'s superRefine rejected any `kind: 'slotted'` page that didn't +provide a `slots` map — but a slotted page with no overrides is valid: every +slot falls through to the synthesized default layout, the natural starting +point before you add overrides. Requiring `slots` up front made the Studio +"New Page" form a dead-end the moment you picked "slotted" (the form can't +author a slot map), the same trap as the old required `regions`. diff --git a/packages/spec/src/ui/page.zod.ts b/packages/spec/src/ui/page.zod.ts index 6b4ab6b689..95f7f53ceb 100644 --- a/packages/spec/src/ui/page.zod.ts +++ b/packages/spec/src/ui/page.zod.ts @@ -415,13 +415,12 @@ export const PageSchema = lazySchema(() => z.object({ message: 'blankLayout is required when type is "blank"', }); } - if (data.kind === 'slotted' && !data.slots) { - ctx.addIssue({ - code: z.ZodIssueCode.custom, - path: ['slots'], - message: 'slots is required when kind is "slotted"', - }); - } + // NOTE: `kind: 'slotted'` does NOT require `slots`. A slotted page with no + // overrides renders the synthesized default layout (every slot falls through + // to the default) — the natural starting point: create the slotted shell, + // then add slot overrides in the editor. Requiring `slots` up front made the + // Studio "New Page" form a dead-end the moment you picked "slotted" (the form + // can't author a slot map), the same trap as the old required `regions`. })); export type Page = z.infer;