Repository navigation
test(fix): type the website template's theme selector for Radix Select 2.4 - #623
Conversation
…t 2.4 Every fresh-payload-smoke website shard on main failed at "fresh project TypeScript" after bb0a9dc (run 38280391767), with no change on our side: src/providers/Theme/ThemeSelector/index.tsx(37,13): error TS2322: Type '(themeToSet: Theme & "auto") => void' is not assignable to type '(value: string) => void'. create-payload-app's website template types the theme handler's parameter as `Theme & 'auto'`, which is `never`. @radix-ui/react-select 2.4.0 (published 2026-10-12 00:47Z, matched by the template's ^2.0.0) declares onValueChange as a function-typed property instead of a method, so TypeScript now checks the handler strictly and rejects it. Payload's main still has the typo. applyFreshPayloadTemplateCompatibility already patches upstream template problems the smoke shouldn't fail on (the button's missing client boundary). It now also widens the parameter to `Theme | 'auto'` and narrows the Select's string at the call site. The patch is a no-op once Payload fixes the template, and tests cover both cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to The compatibility update is mergeable after normal checks; no concrete issue remains identified. Pre-merge checks |
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Why
Main went red after #619 (
bb0a9dc5, run 38280391767). All fourfresh-payload-smoke (website, N)shards failed at fresh project TypeScript:That file belongs to create-payload-app's website template, not to any of our components. Nothing on our side changed. #619's own PR run passed on 2026-10-11.
Theme & 'auto'. WithTheme = 'dark' | 'light', that isnever. The intent is clearlyTheme | 'auto'.@radix-ui/react-select2.4.0 was published 2026-10-12 00:47Z, and the template's^2.0.0picks it up. It declaresonValueChange?: ((value: string) => void) | undefinedas a property, where it used to be a method. TypeScript checks function-typed properties strictly (contravariantly), so the never-typed handler, which method syntax used to let through, is now an error.mainstill has the typo. No upstream issue or PR exists yet.Until this lands, every PR's website shards fail the same way, and tonight's nightly will too.
What
applyFreshPayloadTemplateCompatibilityis the harness's existing hook for upstream template problems the smoke shouldn't fail on. It already adds the generated button's missing'use client'. It now also patches the theme selector:(themeToSet: Theme & 'auto')becomes(themeToSet: Theme | 'auto')<Select onValueChange={onThemeChange}becomes<Select onValueChange={(value) => onThemeChange(value as Theme | 'auto')}It only patches when both original snippets are present, so it becomes a no-op once Payload fixes the template. The button patch is unchanged and was split into its own helper.
Verification
tsc --strictcheck against Radix 2.4.0's exactonValueChangetype reproduces CI's error on the original snippet, and the patched snippet compiles.source:build,tsc --noEmit,lintandformat:checkall exit 0.fresh-payload-smoke.int+blog-visual-system.intpass 98/98. That includes two new tests: the selector gets patched once, and an already-fixed selector is left alone.fresh-payload-smoke (website, N)shards.No issue closed.
🤖 Generated with Claude Code
Summary by CodeRabbit