new: notification packages upgrade for Solid 2.0#893
Conversation
- Add @solid-primitives/notification package (stage 0) with isNotificationSupported, makeNotification, createNotification, createNotificationPermission - Migrate @solid-primitives/permission to Solid 2.0 beta.10: isServer from @solidjs/web, ownedWrite on signals, split createEffect with closure-based cleanup, onCleanup at function scope Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Takes the upstream changeset (.changeset/sweet-olives-talk.md) for the permission package Solid 2.0 migration. Conflict resolution kept our beta.10-compatible implementation: isServer from @solidjs/web, ownedWrite on signals, and closure-based effect cleanup (vs upstream's beta.8 approach). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
# Conflicts: # pnpm-lock.yaml
🦋 Changeset detectedLatest commit: c136eba The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
# Conflicts: # pnpm-lock.yaml
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 @.changeset/notification-initial.md:
- Around line 12-14: Update the release note to match the shipped
implementation: change the server/unsupported fallback for
createNotificationPermission() from "denied" to "unknown" (the value returned by
the permission accessor when Notification is unsupported) and correct the peer
dependency versions from `solid-js@^2.0.0-beta.10` and
`@solidjs/web@^2.0.0-beta.10` to the actual `beta.14` pins used by the package
so the note accurately reflects createNotificationPermission() behavior and peer
deps.
In `@packages/notification/README.md`:
- Around line 97-104: The README examples are missing required Solid imports;
update the snippets to import Solid primitives used so they are copy-paste
runnable by adding imports for createEffect and any other primitives used (e.g.,
Show, Component) at the top of each example block; locate examples referencing
createEffect, Show, and Component and add corresponding import statements (e.g.,
import { createEffect, Show, Component } from "solid-js" or split into separate
imports) so each snippet is self-contained and runnable.
- Around line 116-131: The README incorrectly states that requestPermission
returns a NotificationPermission value and that permission changes from
"unknown" to "denied"; update the docs to match the actual API: note that
createNotificationPermission.permission() yields "unknown" on the server or when
the Notification API is unavailable and that requestPermission() resolves to
Promise<void> (it does not return "granted"|"denied"|"default"). Edit the
example and the descriptive text around createNotificationPermission,
permission, and requestPermission to remove the incorrect return-value
example/await usage and instead show the correct usage (gate UI on permission()
and call requestPermission() without expecting a returned
NotificationPermission).
In `@packages/notification/src/index.ts`:
- Around line 197-212: Update the JSDoc `@returns` to match the actual return
shape of createNotificationPermission: include `pending` alongside `permission`
and `requestPermission` so the doc reads something like `{ permission,
requestPermission, pending }`; locate the JSDoc block above the
createNotificationPermission function and add `pending` to the documented return
contract referencing the same symbol name `pending`.
🪄 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: 92494dd7-d06c-4116-a371-201281f45815
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (14)
.changeset/notification-initial.md.changeset/sweet-olives-talk.mdpackages/notification/LICENSEpackages/notification/README.mdpackages/notification/dev/index.tsxpackages/notification/package.jsonpackages/notification/src/index.tspackages/notification/test/index.test.tspackages/notification/test/server.test.tspackages/notification/tsconfig.jsonpackages/permission/README.mdpackages/permission/package.jsonpackages/permission/src/index.tspackages/permission/test/index.test.ts
Key design decisions:
makeNotificationhas noonCleanupinside — consistent with themake*non-reactive contract; callers registerclosewithonCleanupthemselvescreateNotificationaccepts a thirdhandlersargument (NotificationEventHandlers) foronClick,onClose, andonErrorcallbacks; all listeners are removed onclose()createNotificationPermissiondelegates to@solid-primitives/permissionand surfaces the Permissions API's"prompt"vocabulary (vs Notifications API's"default")console.warnwhenshow()is called without permissionWhat this migrates
@solid-primitives/permissionis updated to Solid 2.0 beta.10:isServerimport moved fromsolid-js/web→@solidjs/webon()removed; replaced with splitcreateEffect(compute, apply){ ownedWrite: true }to allow writes from async Promise callbacks and event listeners outside a reactive owneronCleanupregistered at function scope (not inside the split effectapply, which has no reactive owner in beta.10) via a closure variableflush()rather than capturing viacreateEffectMerge note
Incorporates
upstream/update/v2/permission(Alex Lohr's beta.8 migration). Conflict resolution kept our beta.10-compatible implementation throughout; the upstream's changeset (.changeset/sweet-olives-talk.md, marking permission as a major update) was taken as-is.Files changed
packages/notification/(src, test × 2, dev, README, package.json, tsconfig, LICENSE, changeset)packages/permission/src, test, package.json, READMESummary by CodeRabbit
New Features
Improvements
Documentation