Skip to content

upgrade: sse package upgrade for Solid 2.0#844

Open
davedbase wants to merge 8 commits into
solidjs-community:nextfrom
davedbase:update/v2/sse
Open

upgrade: sse package upgrade for Solid 2.0#844
davedbase wants to merge 8 commits into
solidjs-community:nextfrom
davedbase:update/v2/sse

Conversation

@davedbase
Copy link
Copy Markdown
Member

@davedbase davedbase commented Apr 20, 2026

  • Update peer/dev deps to solid-js 2.0.0-beta.7
  • Add ownedWrite: true to signals written from EventSource callbacks
  • Use createComputed (synchronous) for reactive URL re-connection
  • Add makeSSEAsyncIterable and createSSEStream for async-iterable API
  • Expand test coverage for reconnect, reactive URL, and stream APIs

Summary by CodeRabbit

  • Breaking Changes

    • Removed pending and error properties from SSE return value
    • data accessor now throws NotReadyError during loading instead of returning undefined
    • Error handling consolidated: terminal errors propagate through data() accessor
  • New Features

    • Added makeSSEAsyncIterable to wrap SSE endpoints as async iterables
    • Added createSSEStream as a minimal reactive SSE alternative
    • Added re-exports of Solid 2.0 async reactivity primitives
  • Documentation

    • Updated examples and guidance for new error-boundary patterns with <Loading> and <Errored> components

Review Change Stack

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 20, 2026

🦋 Changeset detected

Latest commit: 699fca7

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/sse Minor

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 draft April 20, 2026 02:27
@davedbase davedbase changed the base branch from main to next April 21, 2026 01:47
@davedbase davedbase added this to the Solid 2.0 Upgrade milestone Apr 21, 2026
davedbase added 2 commits May 2, 2026 18:07
# Conflicts:
#	packages/sse/README.md
#	packages/sse/src/sse.ts
#	packages/sse/test/index.test.ts
#	pnpm-lock.yaml
@davedbase davedbase marked this pull request as ready for review May 23, 2026 22:07
@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: b56f48c9-6627-4f35-b5a2-f33df0cb68fa

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:

  • 🔍 Trigger review
✨ 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: 2

🧹 Nitpick comments (1)
packages/sse/test/index.test.ts (1)

246-266: ⚡ Quick win

Assert pending state immediately after reconnect paths.

Line 246 and Line 269 claim data resets to pending, but the tests only assert eventual new data. Add an immediate throw assertion after reconnect() / setUrl(...) to prevent stale-data regressions from slipping through.

✅ Suggested assertion additions
   reconnect();
   flush();
+  expect(() => data()).toThrow();
   // Old source closed, new source opened
   expect(source()).not.toBe(first);
@@
   setUrl("https://example.com/v2/events");
   flush();
+  expect(() => data()).toThrow();
   // Old source closed, new source opened for v2
   expect(source()).not.toBe(first);

Also applies to: 269-291

🤖 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/sse/test/index.test.ts` around lines 246 - 266, After calling
reconnect() or setUrl(...) in the createSSE test, add an immediate assertion
that data() is in the pending/reset state (i.e., the observable returned by
createSSE should indicate "pending" right after the reconnection is initiated)
before advancing timers or simulating messages; update both the reconnect() test
and the setUrl(...) test to assert data() equals the pending/reset value
immediately after calling reconnect() or setUrl(...) and before any
vi.advanceTimersByTime/flush/simulateMessage calls so stale-data regressions are
caught.
🤖 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/sse/README.md`:
- Line 16: The TOC entry for createSSEStream uses the wrong fragment
(`#createssesstream`); update the link target to the correct anchor for the header
(use `#createssestream`) so the `createSSEStream` TOC link points to the actual
section; search for the TOC line referencing `createSSEStream` and replace the
fragment in the markdown link.

In `@packages/sse/vitest.config.ts`:
- Around line 18-29: The alias entries for "solid-js/web" and "`@solidjs/web`" use
hard-coded pnpm store paths; update both alias values to use module-relative
entry paths instead (server.js vs web.js) so resolution doesn't depend on pnpm
internals: replace the long ".pnpm/…/@solidjs/web/dist/..." strings with
relative module paths like "../../node_modules/@solidjs/web/dist/server.js" when
testSSR is true and "../../node_modules/@solidjs/web/dist/web.js" when false
(apply the same change for both "solid-js/web" and "`@solidjs/web`" alias
definitions in vitest.config.ts).

---

Nitpick comments:
In `@packages/sse/test/index.test.ts`:
- Around line 246-266: After calling reconnect() or setUrl(...) in the createSSE
test, add an immediate assertion that data() is in the pending/reset state
(i.e., the observable returned by createSSE should indicate "pending" right
after the reconnection is initiated) before advancing timers or simulating
messages; update both the reconnect() test and the setUrl(...) test to assert
data() equals the pending/reset value immediately after calling reconnect() or
setUrl(...) and before any vi.advanceTimersByTime/flush/simulateMessage calls so
stale-data regressions are caught.
🪄 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: 1a5fdceb-fb6a-407d-a0ee-e1706ed8f1aa

📥 Commits

Reviewing files that changed from the base of the PR and between d1f2729 and 6a410c0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • .changeset/sse-solid2-async-reactivity.md
  • packages/sse/README.md
  • packages/sse/package.json
  • packages/sse/src/index.ts
  • packages/sse/src/sse.ts
  • packages/sse/test/index.test.ts
  • packages/sse/test/server.test.ts
  • packages/sse/test/worker.test.ts
  • packages/sse/vitest.config.ts

Comment thread packages/sse/README.md Outdated
Comment thread packages/sse/vitest.config.ts
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