upgrade: props package upgrade for Solid 2.0#908
Conversation
🦋 Changeset detectedLatest commit: 1e74307 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)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/props/README.md`:
- Around line 143-145: The README incorrectly describes filterProps as eager;
update the text to match the implementation by replacing the word "eagerly" with
"lazily" and rephrase the first sentence to state that filterProps splits props
lazily (per-read) rather than eagerly, and ensure the following sentence clearly
states that the predicate is executed on every property access and tracks
signals; reference the filterProps primitive and its predicate behavior so
readers know the predicate runs per property read and will re-run when tracked
signals change.
In `@packages/props/src/combineProps.ts`:
- Around line 178-188: The handling of class/className values in the
class-combining block pushes array-valued class entries into parts without
flattening, which can produce nested arrays; modify the branch that iterates
sources (the loop that reads access(s)[key] and pushes into parts) to detect
when v is an array (JSX.ClassList or string[]) and push its elements
individually (flatten one level) rather than the array itself so the final
returned value from the class/className handling (the parts variable) is a flat
array or joined string as before; update the logic that checks parts.length and
parts.every(...) to work unchanged with the flattened parts.
🪄 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: 369c94d4-10ef-43cc-b8e7-81706e63b0c0
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
.changeset/props-solid2-migration.mdpackages/props/README.mdpackages/props/dev/index.tsxpackages/props/package.jsonpackages/props/src/combineProps.tspackages/props/src/filterProps.tspackages/props/test/combineProps.test.tspackages/props/test/filterProps.test.tspackages/props/test/server.test.ts
# Conflicts: # pnpm-lock.yaml
Summary
Upgrades the props package to
solid-js@^2.0.0-beta.13/@solidjs/web@^2.0.0-beta.13and adds two new utilities:combineHandlersandpartitionProps.Breaking changes
Peer dependencies updated
solid-js@^2.0.0-beta.13and@solidjs/web@^2.0.0-beta.13are now required.classListsupport removedSolid 2.0 removes the
classListJSX prop in favour ofclassaccepting objects and arrays.combinePropsno longer handles aclassListkey. Pass an object or array asclassinstead:classcombining semantics updatedWhen all combined
classvalues are strings they are joined with a space (unchanged). When any value is aClassListobject or array the result is a flat array, which Solid 2.0'sclassprop accepts natively.mergereplacesmergePropssemanticsNon-special props now follow
mergesemantics: an explicitundefinedin a later source overrides earlier values (previouslyundefinedwas skipped).New utilities
combineHandlersChains multiple event handlers into one. Handlers that are
null,undefined, orfalseare silently skipped — useful for conditional handlers inline. Returns the single handler unchanged when only one is present (no wrapping overhead). Reactive through Solid's props proxy when used in JSX; for a standalone signal source, read it explicitly before passing or wrap the call increateMemo.partitionPropsSplits a props object into
[matched, rest]— both views are lazy reactive proxies powered byfilterPropsunder the hood, so the predicate runs per property read and both halves stay in sync with dynamic props. For an expensive predicate, pass acreatePropsPredicateresult to share a single cache across both views.Internal changes
mergeProps→merge,MergeProps→MergethroughoutJSXtype imported from@solidjs/webcreateMemo(fn, undefined, options)→createMemo(fn, options)(initialValue arg removed in 2.0)createComputedreplaced withcreateEffect(compute, apply)+flush(); signals created outsidecreateRootto avoidSIGNAL_WRITE_IN_OWNED_SCOPEtest/server.test.ts)Summary by CodeRabbit
New Features
combineHandlersandpartitionPropshelper utilities.Breaking Changes
classListJSX prop support; useclasswith objects/arrays instead.undefinedvalues override earlier values.