Skip to content

Commit 8801c02

Browse files
os-zhuangclaude
andauthored
fix(spec): don't require slots on slotted pages (#2261)
`PageSchema`'s superRefine rejected any `kind: 'slotted'` page without a `slots` map. But a slotted page with no overrides is valid and useful — 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 instant you picked "slotted" (the form can't author a slot map), the same trap as the old required `regions`. Removed the superRefine clause; `slots` stays optional. Found by dogfooding the Studio page designer. Verified: slotted-without-slots now parses; 86 page tests pass. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent eb1b987 commit 8801c02

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
"@objectstack/spec": patch
3+
---
4+
5+
fix(spec): don't require `slots` on slotted pages
6+
7+
`PageSchema`'s superRefine rejected any `kind: 'slotted'` page that didn't
8+
provide a `slots` map — but a slotted page with no overrides is valid: every
9+
slot falls through to the synthesized default layout, the natural starting
10+
point before you add overrides. Requiring `slots` up front made the Studio
11+
"New Page" form a dead-end the moment you picked "slotted" (the form can't
12+
author a slot map), the same trap as the old required `regions`.

packages/spec/src/ui/page.zod.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -415,13 +415,12 @@ export const PageSchema = lazySchema(() => z.object({
415415
message: 'blankLayout is required when type is "blank"',
416416
});
417417
}
418-
if (data.kind === 'slotted' && !data.slots) {
419-
ctx.addIssue({
420-
code: z.ZodIssueCode.custom,
421-
path: ['slots'],
422-
message: 'slots is required when kind is "slotted"',
423-
});
424-
}
418+
// NOTE: `kind: 'slotted'` does NOT require `slots`. A slotted page with no
419+
// overrides renders the synthesized default layout (every slot falls through
420+
// to the default) — the natural starting point: create the slotted shell,
421+
// then add slot overrides in the editor. Requiring `slots` up front made the
422+
// Studio "New Page" form a dead-end the moment you picked "slotted" (the form
423+
// can't author a slot map), the same trap as the old required `regions`.
425424
}));
426425

427426
export type Page = z.infer<typeof PageSchema>;

0 commit comments

Comments
 (0)