upgrade: page-utilities packages migration and adaptation upgrade for Solid 2.0 #901
upgrade: page-utilities packages migration and adaptation upgrade for Solid 2.0 #901davedbase wants to merge 5 commits into
Conversation
🦋 Changeset detectedLatest commit: cebf743 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: 2
🤖 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/page-utilities/package.json`:
- Around line 19-23: Add the exported hook usePageVisibility to the primitive
listing so docs tooling includes it: update the "list" array in the package's
package.json (primitive.list) to include "usePageVisibility", matching the
export in packages/page-utilities/src/index.ts (which currently exports
usePageVisibility) so the public API and generated primitives docs stay in sync.
In `@packages/page-utilities/README.md`:
- Around line 16-17: Fix the README TOC and heading-level lint warnings by
updating the TOC link for createPageLeaveBlocker to match the exact heading id
(use `#createPageLeaveBlocker` with correct camelCase) and change all overly-deep
"#### Definition" headings to "### Definition" so they increment correctly from
the surrounding "##" sections; apply the same "#### → ###" fix to the other
Definition sections referenced for consistency.
🪄 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: fc472dad-834d-4306-9309-8c3fa5480c97
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
.changeset/page-utilities-solid2-migration.md.changeset/pre.jsonpackages/page-utilities/CHANGELOG.mdpackages/page-utilities/LICENSEpackages/page-utilities/README.mdpackages/page-utilities/package.jsonpackages/page-utilities/src/index.tspackages/page-utilities/test/index.test.tspackages/page-utilities/test/server.test.tspackages/page-utilities/tsconfig.jsonpackages/page-visibility/README.mdpackages/page-visibility/src/index.tspackages/page-visibility/test/index.test.ts
💤 Files with no reviewable changes (3)
- packages/page-visibility/src/index.ts
- packages/page-visibility/test/index.test.ts
- packages/page-visibility/README.md
Migrates the former
@solid-primitives/page-visibilitypackage to Solid.js v2.0 (beta.13), adds two new navigation-blocking primitives, and renames the package to@solid-primitives/page-utilitiesto reflect its broader scope.Solid 2.0 migration
isServerimport moved fromsolid-js/web→@solidjs/webINTERNAL_OPTIONS(ownedWrite: true) added to the internal signal — required because DOM event handlers firing within an owned scope trigger Solid 2.0's write guardflush()added in tests afterdispatchEventcalls to commit pending signal values before assertingtest/server.test.tsadded to verify SSR behavioursolid-js@^2.0.0-beta.13and@solidjs/web@^2.0.0-beta.13New primitives:
makePageLeaveandcreatePageLeaveBlockermakePageLeaveis the base primitive — it attaches abeforeunloadlistener that callse.preventDefault()to trigger the browser's built-in "Leave site?" dialog, and returns a cleanup function.createPageLeaveBlockeris the reactive wrapper. It accepts an optionalMaybeAccessor<boolean>(defaulttrue) so navigation blocking can be toggled reactively — the most practical pattern being gating on unsaved state:Static
true/falsewires up synchronously viaonCleanup; a signal uses the Solid 2.0 splitcreateEffect(compute, apply)pattern to arm and disarm the listener as the value changes.Package rename
@solid-primitives/page-visibility→@solid-primitives/page-utilities. The package now covers page-level browser concerns beyond just visibility, and the name change reflects that.Breaking changes
@solid-primitives/page-utilitiessolid-js@^2.0.0-beta.13and `@solidjs/web@^2.0.0-beta.13Summary by CodeRabbit
Release Notes
Breaking Changes
isServermust now be imported from@solidjs/webinstead ofsolid-js/web@solid-primitives/page-visibilityhas been replaced by@solid-primitives/page-utilitiesNew Features