upgrade: share package upgrade for Solid 2.0#867
Conversation
🦋 Changeset detectedLatest commit: eb3f303 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: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/share/dev/index.tsx (1)
7-23:⚠️ Potential issue | 🟠 Major | ⚡ Quick winUpdate the dev example to the new
createWebShare()contract.Line 7 still uses the old signature (
createWebShare(data)), Lines 15–19 treat accessors as plain values, and Line 21 updates local state instead of invokingshare(...). This demo is now incompatible with the migrated API.Suggested fix
-import { type Component, createSignal } from "solid-js"; +import { type Component } from "solid-js"; @@ const App: Component = () => { - const [data, setData] = createSignal<ShareData>({}); - const shareStatus = createWebShare(data); + const { share, status, message } = createWebShare(); @@ - {shareStatus.status === undefined + {status() === undefined ? "Haven't started sharing yet." - : shareStatus.status + : status() ? "Sharing success" - : `Sharing failed, ${shareStatus.message}`} + : `Sharing failed, ${message()}`} </p> - <button class="btn" onClick={() => setData({ url: "https://solidjs.com" })}> + <button class="btn" onClick={() => share({ url: "https://solidjs.com" })}> Share </button>🤖 Prompt for 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. In `@packages/share/dev/index.tsx` around lines 7 - 23, The demo still uses the old createWebShare(data) signature and treats returned status/message as plain values and uses setData to update state; update it to the new API by calling createWebShare() without args, use its returned share function to trigger sharing (e.g., share(dataObject)) instead of setData, and treat shareStatus.status and shareStatus.message as accessors (call shareStatus.status() and shareStatus.message()) when rendering the message; ensure the Share button calls share({ url: "https://solidjs.com" }) rather than setData.
🤖 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/share/README.md`:
- Around line 159-175: The JSX example uses the <Show> component but the import
block only imports createWebShare; update the imports to include Show so the
snippet is runnable (add Show to the import list from the appropriate Solid
library where createWebShare is used), then ensure the example continues to use
createWebShare(), share, pending, status, and message as shown.
---
Outside diff comments:
In `@packages/share/dev/index.tsx`:
- Around line 7-23: The demo still uses the old createWebShare(data) signature
and treats returned status/message as plain values and uses setData to update
state; update it to the new API by calling createWebShare() without args, use
its returned share function to trigger sharing (e.g., share(dataObject)) instead
of setData, and treat shareStatus.status and shareStatus.message as accessors
(call shareStatus.status() and shareStatus.message()) when rendering the
message; ensure the Share button calls share({ url: "https://solidjs.com" })
rather than setData.
🪄 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: a584bde9-dfba-4cf7-bd66-f8985d037fc7
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (9)
.changeset/share-solid2-migration.mdpackages/share/README.mdpackages/share/dev/index.tsxpackages/share/package.jsonpackages/share/src/networks.tspackages/share/src/social-share.tspackages/share/src/web-share.tspackages/share/test/index.test.tspackages/share/test/server.test.ts
Migrate
@solid-primitives/shareto Solid.js v2.0 (beta.10)**Updates peer/dev dependencies to
solid-js@^2.0.0-beta.10and@solidjs/web@^2.0.0-beta.10. ReplacesisServerimports from the deprecatedsolid-js/webpath with@solidjs/web, and rewrites thecreateEffectinsidecreateWebShareto the split compute/apply pattern Solid 2.0 enforces (theonhelper was removed upstream). All browser and SSR tests pass.Summary by CodeRabbit
New Features
pending,status,message).makeWebSharefor direct Web Share API integration.Warpcastto supported social networks.Breaking Changes
createSocialSharenow returns an object instead of a tuple.createWebSharerefactored as an imperative action instead of signal-driven.Baidufrom supported networks.