Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change: migrate to nightly and csr features rather than stable and default-features = false #1227

Merged
merged 8 commits into from
Jun 27, 2023

Conversation

gbj
Copy link
Collaborator

@gbj gbj commented Jun 23, 2023

Closes #567.

Ideally, I would have done this from 0.0.1, but I was younger and more foolish then 😄.

Ideally, Cargo features should be additive, not subtractive or mutually exclusive, i.e., each feature should enable additional functionality in the crate.

We do use a few mutually-exclusive features (csr, ssr, and hydrate). This is because they enable different behavior or enable certain optimizations for the different platforms, in a better way than the alternatives. (For example, using target_arch = wasm32 to detect the browser would fail to support the growing number of server-side WASM environments; using a generic View that could be either a DOM element or an SSR version wouldn't let us detect SSR mode for compile-time SSR optimizations; etc.)

However, the stable feature was just a bad idea. The crate was originally nightly-only, and I added the stable feature when asked to support stable. This causes some downstream issues for libraries due to feature unification.

This PR reverses the current setup so that nightly is now an opt-in feature, which basically enables the function-call syntax for signal getters and setters.

While we're breaking things, it also removes the default csr feature from the leptos crate, which now works the same way as leptos_router and leptos_meta: you should opt into csr, ssr, or hydrate.

This means that leptos = "0.x" should now be something like leptos = { version = "0.x", features = ["csr", "nightly"] } It also means all the default-features = false can be dropped from Cargo.toml for setups using SSR + hydration, as Leptos will no longer default to CSR.

Todos

  • Finish checking examples
  • Update docs

@gbj gbj closed this Jun 23, 2023
@gbj gbj reopened this Jun 23, 2023
@gbj gbj mentioned this pull request Jun 14, 2023
14 tasks
@gbj gbj merged commit ee7dbaf into main Jun 27, 2023
@gbj gbj deleted the features branch June 27, 2023 01:12
@gbj
Copy link
Collaborator Author

gbj commented Jun 27, 2023

Migration:

  • If you're using CSR, add the csr feature to leptos (same as leptos_router and leptos_meta
  • If you're using stable, drop the stable feature -- it's now the default
  • If you're using nightly, add the nightly feature to leptos, leptos_router, and leptos_meta
  • You can remove most default-features = false on Leptos dependencies, as that mainly served to disable the default csr feature when you were using ssr/hydrate, which is no longer necessary

gbj added a commit that referenced this pull request Jun 30, 2023
maccesch pushed a commit to maccesch/leptos that referenced this pull request Jun 30, 2023
gbj added a commit that referenced this pull request Jul 7, 2023
gbj added a commit that referenced this pull request Jul 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use a nightly feature flag instead of stable
1 participant