Skip to content

upgrade: clipboard package upgrade for Solid 2.0#850

Draft
davedbase wants to merge 3 commits intosolidjs-community:nextfrom
davedbase:update/v2/clipboard
Draft

upgrade: clipboard package upgrade for Solid 2.0#850
davedbase wants to merge 3 commits intosolidjs-community:nextfrom
davedbase:update/v2/clipboard

Conversation

@davedbase
Copy link
Copy Markdown
Member

@davedbase davedbase commented Apr 21, 2026

Migrates the clipboard package to Solid.js 2.0

Breaking changes

  • createClipboard now returns an async accessorcreateResource (removed in 2.0) is replaced with an async createMemo. The returned clipboard accessor starts synchronously with an empty array; after refetch() it reads from the clipboard asynchronously. The previous value stays visible during a pending read (isPending(() => clipboard()) returns true).

  • copyToClipboard directive → ref function — Solid 2.0 no longer supports the use: directive namespace extension pattern. copyToClipboard is now a factory that returns a ref callback:

    // before
    <input use:copyToClipboard />
    
    // after
    <input ref={copyToClipboard()} />
    <button ref={copyToClipboard({ value: "copy me" })}>Copy</button>

    The declare module "solid-js" JSX directive augmentation has been removed accordingly.

  • isServer import — moved from solid-js/web@solidjs/web.

  • Peer dependency bumped to solid-js@^2.0.0-beta.

Internal

  • Extracted readClipboardItems() async helper (replaces inline on+createResource pattern).
  • Fixed a long-standing typo in the element tag check: "texfield" → ``"textarea"`.
  • copyToClipboard now uses @ts-expect-error instead of @ts-ignore.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 21, 2026

🦋 Changeset detected

Latest commit: 64822b1

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/clipboard 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 changed the base branch from main to next April 21, 2026 01:46
@davedbase davedbase added this to the Solid 2.0 Upgrade milestone Apr 21, 2026
Comment thread packages/utils/src/index.ts
davedbase added 2 commits May 2, 2026 17:46
# Conflicts:
#	packages/utils/src/index.ts
#	pnpm-lock.yaml
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.

2 participants