Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/slotted-page-no-slots-required.md
Original file line number Diff line number Diff line change
@@ -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`.
13 changes: 6 additions & 7 deletions packages/spec/src/ui/page.zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof PageSchema>;
Expand Down