upgrade: page-utilities packages migration and adaptation upgrade for Solid 2.0 #901
Open
davedbase wants to merge 3 commits into
Open
upgrade: page-utilities packages migration and adaptation upgrade for Solid 2.0 #901davedbase wants to merge 3 commits into
davedbase wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 509e581 The changes in this PR will be included in the next version bump. 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.13