upgrade: controlled-props package upgrade for Solid 2.0#934
Conversation
🦋 Changeset detectedLatest commit: a202c71 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/controlled-props/src/index.tsx`:
- Around line 113-122: The onChange handler can throw if options() is empty
because options()[ev.currentTarget.selectedIndex] may be undefined; update the
select's onChange in this component to guard that lookup (use a local const item
= options()[ev.currentTarget.selectedIndex]; if (!item) return or call
props.setValue with a safe default), so references to item[1] never access
undefined; touch the onChange closure that currently calls
props.setValue(options()[...][1]) and perform the existence check before
accessing the tuple element.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0cba0acd-5d41-4574-ad25-061ee6b62d7b
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
.changeset/controlled-props-solid2-migration.mdpackages/controlled-props/README.mdpackages/controlled-props/dev/index.tsxpackages/controlled-props/package.jsonpackages/controlled-props/src/index.tsxpackages/controlled-props/stories/controlled-props.stories.tsxpackages/controlled-props/test/testProps.test.tsx
💤 Files with no reviewable changes (1)
- packages/controlled-props/dev/index.tsx
…base/solid-primitives into update/v2/controlled-props
Migrates
@solid-primitives/controlled-propsto Solid.js 2.0 beta.14, fixes several pre-existing bugs uncovered during the migration, adds new utilities, and adds Storybook stories.Breaking Changes
solid-js@^2.0.0-beta.14and@solidjs/web@^2.0.0-beta.14JSXtype moved fromsolid-jsto@solidjs/webcreateControlledPropsetters are now batched; callflush()fromsolid-jsbefore reading updated values in testsownedWrite: trueon the internal signal — required so setters can be called from within reactive scopes (component bodies, effects) without theSIGNAL_WRITE_IN_OWNED_SCOPEerrorBug Fixes
min/max/stepsilently ignored —NumberPropandRangePropwere constructed without forwarding options; fixed by extracting them before the returnSelectPropstale aftersetValue— the selected index was computed once withuntrackat render time, so callingsetValueafter render had no visible effect; replaced with a reactivecreateMemothat tracksprops.value()createSignaltype error — initial value now cast toExclude<T, Function>to satisfy Solid 2.0's new function-form overload for derived signalsNew Features
RangeProp— new exported component that renders a range slider (<input type="range">) with a live value readout; also accessible as a standalone componentstepoption —TestPropOptionsnow exposesstepand forwards it to bothNumberPropand `RangePropSummary by CodeRabbit
Release Notes
New Features
RangePropcomponent for range slider controlsstepoption tocreateControlledPropfor discrete incrementsDocumentation
Tests
Chores