Skip to content

Commit

Permalink
Merge pull request #3037 from leptos-rs/rename-island-router
Browse files Browse the repository at this point in the history
change: rename island-router feature so people don't use it
  • Loading branch information
gbj authored Oct 1, 2024
2 parents 699c54e + 94f4328 commit d10fec0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 23 deletions.
2 changes: 1 addition & 1 deletion examples/islands_router/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ leptos = { path = "../../leptos", features = [
leptos_router = { path = "../../router" }
server_fn = { path = "../../server_fn", features = ["serde-lite"] }
leptos_axum = { path = "../../integrations/axum", features = [
"islands-router",
"dont-use-islands-router",
], optional = true }
log = "0.4.22"
serde = { version = "1.0", features = ["derive"] }
Expand Down
25 changes: 10 additions & 15 deletions examples/islands_router/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
# Leptos Todo App Sqlite with Axum
# Work in Progress

This example creates a basic todo app with an Axum backend that uses Leptos' server functions to call sqlx from the client and seamlessly run it on the server.
This example is something I wrote on a long layover in the Orlando airport in July. (It was really hot!)

## Getting Started
It is the culmination of a couple years of thinking and working toward being able to do this, which you can see
described pretty well in the pinned roadmap issue (#1830) and its discussion of different modes of client-side
routing when you use islands.

See the [Examples README](../README.md) for setup and run instructions.
This uses *only* server rendering, with no actual islands, but still maintains client-side state across page navigations.
It does this by building on the fact that we now have a statically-typed view tree to do pretty smart updates with
new HTML from the client, with extremely minimal diffing.

## E2E Testing

See the [E2E README](./e2e/README.md) for more information about the testing strategy.

## Rendering

See the [SSR Notes](../SSR_NOTES.md) for more information about Server Side Rendering.

## Quick Start

Run `cargo leptos watch` to run this example.
The demo itself works, but the feature that supports it is incomplete. A couple people have accidentally
used it and broken their applications in ways they don't understand, so I've renamed the feature to `dont-use-islands-router`.
2 changes: 1 addition & 1 deletion integrations/actix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ once_cell = "1"
rustdoc-args = ["--generate-link-to-definition"]

[features]
islands-router = []
dont-use-islands-router = []
tracing = ["dep:tracing"]

[package.metadata.cargo-all-features]
Expand Down
2 changes: 1 addition & 1 deletion integrations/actix/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ where
IV: IntoView + 'static,
{
Box::pin(async move {
let app = if cfg!(feature = "islands-router") {
let app = if cfg!(feature = "dont-use-islands-router") {
app.to_html_stream_in_order_branching()
} else {
app.to_html_stream_in_order()
Expand Down
2 changes: 1 addition & 1 deletion integrations/axum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ tokio = { version = "1.39", features = ["net", "rt-multi-thread"] }
[features]
wasm = []
default = ["tokio/fs", "tokio/sync", "tower-http/fs", "tower/util"]
islands-router = []
dont-use-islands-router = []
tracing = ["dep:tracing"]

[package.metadata.docs.rs]
Expand Down
8 changes: 4 additions & 4 deletions integrations/axum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ where
_ = replace_blocks; // TODO
handle_response(additional_context, app_fn, |app, chunks| {
Box::pin(async move {
let app = if cfg!(feature = "islands-router") {
let app = if cfg!(feature = "dont-use-islands-router") {
app.to_html_stream_out_of_order_branching()
} else {
app.to_html_stream_out_of_order()
Expand Down Expand Up @@ -849,7 +849,7 @@ where
IV: IntoView + 'static,
{
handle_response(additional_context, app_fn, |app, chunks| {
let app = if cfg!(feature = "islands-router") {
let app = if cfg!(feature = "dont-use-islands-router") {
app.to_html_stream_in_order_branching()
} else {
app.to_html_stream_in_order()
Expand Down Expand Up @@ -1069,7 +1069,7 @@ where
{
handle_response(additional_context, app_fn, |app, chunks| {
Box::pin(async move {
let app = if cfg!(feature = "islands-router") {
let app = if cfg!(feature = "dont-use-islands-router") {
app.to_html_stream_in_order_branching()
} else {
app.to_html_stream_in_order()
Expand Down Expand Up @@ -1146,7 +1146,7 @@ where
IV: IntoView + 'static,
{
Box::pin(async move {
let app = if cfg!(feature = "islands-router") {
let app = if cfg!(feature = "dont-use-islands-router") {
app.to_html_stream_in_order_branching()
} else {
app.to_html_stream_in_order()
Expand Down

0 comments on commit d10fec0

Please sign in to comment.