upgrade: match package upgrade for Solid 2.0#913
Conversation
🦋 Changeset detectedLatest commit: 7f584f1 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 |
Solid 2.0 migration
Dependencies (
package.json)solid-jsbumped from^1.9.7→2.0.0-beta.13@solidjs/web: 2.0.0-beta.13added as both a peer and dev dependencySource (
src/index.ts)JSXtypes moved fromsolid-js(no longer exported there) to@solidjs/webTests (
test/index.test.tsx)s.flush()after everysetValue()call before reading reactive output. Solid 2.0 batches all signal writes by default — without an explicit flush the memo still sees the stale value at read time.Correctness fix: stable accessor in
MatchTagPreviously,
MatchTagallocated a new() => props.onclosure on every recomputation of the outer memo and passed it directly to the matched case handler:The accessor is now lifted to a stable variable defined once per component instance:
Any case handler that stores or compares the accessor reference (e.g. in a
createEffectdependency, aWeakMapkeyed on the function, or a memoized child component) now behaves correctly.Type improvement:
PropertyKey→string | numberAll four
MatchTagoverloads and bothMatchValueoverloads previously constrained discriminant values withPropertyKey(string | number | symbol).symbolwas excluded in practice because it cannot be expressed as a key in an inlinecaseobject literal — TypeScript would reject{ [mySymbol]: handler }at the call site. The old constraint silently accepted type signatures that could never produce a validcaseobject, pushing the error into the mapped type where it is difficult to read.Narrowing to
string | numbermoves the error to the tag field itself and makes the constraint honest. A comment in the source explains the reasoning:Documentation
partialprop: documented on every overload (/** Type-only — no runtime effect. … */) and in the README.partialsolely switches thecasemapped type between required and optional keys — it has no runtime behaviour.MatchField: marked@deprecatedin source (/** @deprecated Use {@link MatchTag} instead. */) and given a deprecation notice in the README.README.md: partial-matching notes updated for bothMatchTagandMatchValue;MatchFieldsection added.CHANGELOG.md: created..changeset/match-solid2-migration.md: created (major bump).Breaking changes for downstream consumers
solid-js ≥ 2.0.0-beta.13and@solidjs/web ≥ 2.0.0-beta.13now requiredstring | number;symboltags no longer acceptedMatchFieldis deprecated — no removal yet, but editors will warnThe public runtime API (
MatchTag,MatchValue, props shape) is otherwise unchanged.Summary by CodeRabbit
New Features
Breaking Changes
solid-js@^2.0.0-beta.13and@solidjs/web@^2.0.0-beta.13.@solidjs/webper Solid 2.0 conventions.Documentation
partialprop behavior and edge cases in README.MatchFieldas deprecated; useMatchTaginstead.