Skip to content

upgrade: share package upgrade for Solid 2.0#867

Open
davedbase wants to merge 7 commits into
solidjs-community:nextfrom
davedbase:update/v2/share
Open

upgrade: share package upgrade for Solid 2.0#867
davedbase wants to merge 7 commits into
solidjs-community:nextfrom
davedbase:update/v2/share

Conversation

@davedbase
Copy link
Copy Markdown
Member

@davedbase davedbase commented May 4, 2026

Migrate @solid-primitives/share to Solid.js v2.0 (beta.10)**

Updates peer/dev dependencies to solid-js@^2.0.0-beta.10 and @solidjs/web@^2.0.0-beta.10. Replaces isServer imports from the deprecated solid-js/web path with @solidjs/web, and rewrites the createEffect inside createWebShare to the split compute/apply pattern Solid 2.0 enforces (the on helper was removed upstream). All browser and SSR tests pass.

Summary by CodeRabbit

  • New Features

    • Added action-based web sharing with reactive state accessors (pending, status, message).
    • Added makeWebShare for direct Web Share API integration.
    • Added Warpcast to supported social networks.
  • Breaking Changes

    • Updated to Solid.js v2.0 (beta.10) with new peer dependencies.
    • createSocialShare now returns an object instead of a tuple.
    • createWebShare refactored as an imperative action instead of signal-driven.
    • Removed Baidu from supported networks.

Review Change Stack

@davedbase davedbase added this to the Solid 2.0 Migration milestone May 4, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: eb3f303

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solid-primitives/share Major

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

@davedbase davedbase marked this pull request as ready for review May 17, 2026 12:35
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b84b678e-b5e6-4e33-8724-ce8cb6ab721d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 win

Update 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 invoking share(...). 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

📥 Commits

Reviewing files that changed from the base of the PR and between 76d6f2e and eb3f303.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .changeset/share-solid2-migration.md
  • packages/share/README.md
  • packages/share/dev/index.tsx
  • packages/share/package.json
  • packages/share/src/networks.ts
  • packages/share/src/social-share.ts
  • packages/share/src/web-share.ts
  • packages/share/test/index.test.ts
  • packages/share/test/server.test.ts

Comment thread packages/share/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant