Skip to content

test(fix): type the website template's theme selector for Radix Select 2.4 - #623

Merged
Ducksss merged 1 commit into
mainfrom
claude/smoke-theme-selector-radix-2-4
Oct 29, 2026
Merged

Ducksss merged 1 commit into
mainfrom
claude/smoke-theme-selector-radix-2-4

Conversation

@Ducksss

@Ducksss Ducksss commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

Why

Main went red after #619 (bb0a9dc5, run 38280391767). All four fresh-payload-smoke (website, N) shards failed at fresh project TypeScript:

src/providers/Theme/ThemeSelector/index.tsx(37,13): error TS2322:
Type '(themeToSet: Theme & "auto") => void' is not assignable to type '(value: string) => void'.
  Types of parameters 'themeToSet' and 'value' are incompatible.
    Type 'string' is not assignable to type 'never'.

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.

  • The template types the handler's parameter as Theme & 'auto'. With Theme = 'dark' | 'light', that is never. The intent is clearly Theme | 'auto'.
  • @radix-ui/react-select 2.4.0 was published 2026-10-12 00:47Z, and the template's ^2.0.0 picks it up. It declares onValueChange?: ((value: string) => void) | undefined as 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.
  • Payload's main still 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

applyFreshPayloadTemplateCompatibility is 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

  • A standalone tsc --strict check against Radix 2.4.0's exact onValueChange type reproduces CI's error on the original snippet, and the patched snippet compiles.
  • source:build, tsc --noEmit, lint and format:check all exit 0.
  • fresh-payload-smoke.int + blog-visual-system.int pass 98/98. That includes two new tests: the selector gets patched once, and an already-fixed selector is left alone.
  • The real proof is this PR's four Linux fresh-payload-smoke (website, N) shards.

No issue closed.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Generated Payload website projects now handle Theme Selector values more reliably, including compatibility with Radix Select 2.4.
    • Generated UI buttons now receive the client-side boundary when needed, helping avoid issues in projects that use these components.

…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]>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 17:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Ducksss/payload-components/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5914b985-48b4-41f5-bc31-c8222d3392d8

📥 Commits

Reviewing files that changed from the base of the PR and between bb0a9dc and d2ba238.


📒 Files selected for processing (2)
  • tests/int/fresh-payload-smoke.int.spec.ts
  • tools/payload-components/smoke/fresh-payload-repo.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Walkthrough

Walkthrough

The compatibility helper retains the conditional button client-boundary update and adds a conditional ThemeSelector handler update. Integration tests check that the ThemeSelector update is applied once and that a string handler remains unchanged.

Changes

Payload template compatibility

Layer / File(s) Summary
Apply and test template compatibility updates
tools/payload-components/smoke/fresh-payload-repo.ts, tests/int/fresh-payload-smoke.int.spec.ts
The helper runs the button client-boundary check and the ThemeSelector update. The ThemeSelector update widens the handler type and casts the callback value when expected source fragments are present. Tests check the first and repeated applications, and verify that a string handler remains unchanged.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix


Merge Risk: ⚪ Minimal · up to d2ba2

The compatibility update is mergeable after normal checks; no concrete issue remains identified.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the test fix for the website template's theme selector and Radix Select 2.4.
Description check Passed The description provides detailed context, implementation scope, and verification results. It does not use the template's exact headings and omits the Registry Checklist and Notes sections, but it is …
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
payload-components Ready Ready Preview Oct 12, 2026 6:11pm UTC

@Ducksss
Ducksss merged commit 6904b04 into main Oct 29, 2026
17 checks passed
@Ducksss
Ducksss deleted the claude/smoke-theme-selector-radix-2-4 branch October 29, 2026 05:18
@Ducksss Ducksss mentioned this pull request Oct 29, 2026

This branch was successfully deployed

1 active deployment
Preview — d2ba2388 Deployed Oct 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants