Skip to content

upgrade: lifecycle package upgrade for Solid 2.0#889

Open
davedbase wants to merge 7 commits into
solidjs-community:nextfrom
davedbase:update/v2/lifecycle
Open

upgrade: lifecycle package upgrade for Solid 2.0#889
davedbase wants to merge 7 commits into
solidjs-community:nextfrom
davedbase:update/v2/lifecycle

Conversation

@davedbase
Copy link
Copy Markdown
Member

@davedbase davedbase commented May 10, 2026

Upgrades @solid-primitives/lifecycle to Solid 2.0 beta.10. All API signatures (createIsMounted, isHydrated, onElementConnect) are unchanged.

Breaking changes for downstream consumers:

  • Peer dependencies now require solid-js@^2.0.0-beta.10 and @solidjs/web@^2.0.0-beta.10
  • Internally: onMountonSettled, getListenergetObserver, sharedConfig.contextsharedConfig.hydrating, isServer from `@solidjs/web

Summary by CodeRabbit

  • Breaking Changes
    • Updated to require Solid.js v2.0 (beta.14) and @solidjs/web v2.0 (beta.14) as peer dependencies.

Review Change Stack

@davedbase davedbase added this to the Solid 2.0 Migration milestone May 10, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 10, 2026

🦋 Changeset detected

Latest commit: dfc3ba8

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/lifecycle 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 marked this pull request as ready for review May 23, 2026 16:05
@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: d4206908-1117-401b-b5f5-ab1824af62ac

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.

*/
export const isHydrated = (): boolean =>
!isServer && (!sharedConfig.context || (!!getListener() && createIsMounted()()));
!isServer && (!sharedConfig.hydrating || (!!getObserver() && createIsMounted()()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that create mutliple isMounted signals in the worst case, since we're async now? Maybe flush() the signal so it is synchronous.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flush doesn't work in onSettled or createTrackedEffect. I added a test to verify if this is a concern at all. It demonstrates the property: a second onSettled registered after createIsMounted can already read isMounted() as true, proving that setIsMounted(true) is applied synchronously within the flush which is exactly why flush() inside onSettled is maybe not needed.

This one is tricky, you may want to study the tests I added more closely and run it directly.

import { createIsMounted, isHydrated } from "../src/index.js";

describe("createIsMounted", () => {
test("createIsMounted", () => {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test that the isMounted signal is not needlessly created multiple times.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few

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