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

Simplify the launch builder #2967

Merged
merged 31 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b9912da
improve documentation for the fullstack server context
ealmloff Sep 11, 2024
7dc123d
Add a section about axum integration to the crate root docs
ealmloff Sep 11, 2024
011af17
make serve_dioxus_application accept the cfg builder directly
ealmloff Sep 12, 2024
cc58274
remove unused server_fn module
ealmloff Sep 12, 2024
bad3cba
improve fullstack config docs
ealmloff Sep 12, 2024
00c4f25
improve documentation for the server function macro
ealmloff Sep 16, 2024
a15c7bd
fix axum router extension link
ealmloff Sep 16, 2024
4b9fc0c
Fix doc tests
ealmloff Sep 16, 2024
d6b4da3
Fix launch builder
ealmloff Sep 16, 2024
0114c83
Merge branch 'main' into more-fullstack-docs
ealmloff Sep 16, 2024
d4afc24
Simplify the launch builder
ealmloff Sep 16, 2024
9c964b7
don't re-export launch in the prelude
ealmloff Sep 16, 2024
c74bb3a
refactor fullstack launch
ealmloff Sep 17, 2024
78ebe52
Merge branch 'more-fullstack-docs' into refactor-launch
ealmloff Sep 17, 2024
4e4935d
Fix fullstack launch builder
ealmloff Sep 17, 2024
3446c14
Update static generation with the new builder api
ealmloff Sep 18, 2024
dd6abb3
fix some formatting/overly broad launch replacements
ealmloff Sep 18, 2024
46e2933
fix custom menu example
ealmloff Sep 18, 2024
e4c59e2
fix fullstack/static generation examples
ealmloff Sep 18, 2024
da90934
Merge branch 'main' into refactor-launch
ealmloff Sep 18, 2024
ef424e3
Fix static generation launch
ealmloff Sep 19, 2024
3de9efd
A few small formatting fixes
ealmloff Sep 19, 2024
5aa92a0
Fix a few doc tests
ealmloff Sep 19, 2024
95f4f2b
implement LaunchConfig for serve configs
ealmloff Sep 20, 2024
fefee9a
fix fullstack launch with separate web and server launch methods
ealmloff Sep 20, 2024
e61c130
fix check with all features
ealmloff Sep 20, 2024
20f3d33
Merge branch 'main' into refactor-launch
ealmloff Oct 4, 2024
6ec65ca
Merge branch 'main' into refactor-launch
jkelleyrtp Oct 10, 2024
74b7b7c
dont expose inner core module
jkelleyrtp Oct 10, 2024
2c8e4aa
clippy and check
jkelleyrtp Oct 10, 2024
59b69b9
fix readme
jkelleyrtp Oct 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example-projects/ecommerce-site/src/components/cart.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion example-projects/ecommerce-site/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod components {
mod api;

fn main() {
launch(|| {
dioxus::launch(|| {
rsx! {
head::Link {
rel: "stylesheet",
Expand Down
2 changes: 1 addition & 1 deletion example-projects/file-explorer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use dioxus::desktop::{Config, WindowBuilder};
use dioxus::prelude::*;

fn main() {
LaunchBuilder::desktop()
dioxus::LaunchBuilder::desktop()
.with_cfg(Config::new().with_window(WindowBuilder::new().with_resizable(true)))
.launch(app)
}
Expand Down
2 changes: 1 addition & 1 deletion example-projects/fullstack-hackernews/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fn main() {
#[cfg(feature = "server")]
tracing_subscriber::fmt::init();

launch(|| rsx! { Router::<Route> {} });
dioxus::launch(|| rsx! { Router::<Route> {} });
}

#[derive(Clone, Routable)]
Expand Down
2 changes: 1 addition & 1 deletion example-projects/wifi-scanner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use dioxus::prelude::*;
use wifiscanner::Wifi;

fn main() {
launch(app)
dioxus::launch(app)
}

fn perform_scan() -> Status {
Expand Down
2 changes: 1 addition & 1 deletion examples/all_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::{collections::VecDeque, fmt::Debug, rc::Rc};
const STYLE: &str = asset!("./examples/assets/events.css");

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/backgrounded_futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use async_std::task::sleep;
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use dioxus::prelude::*;
const STYLE: &str = asset!("./examples/assets/calculator.css");

fn main() {
LaunchBuilder::desktop()
dioxus::LaunchBuilder::desktop()
.with_cfg(desktop!({
use dioxus::desktop::{Config, LogicalSize, WindowBuilder};
Config::new().with_window(
Expand Down
2 changes: 1 addition & 1 deletion examples/calculator_mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use dioxus::html::MouseEvent;
use dioxus::prelude::*;

fn main() {
LaunchBuilder::desktop()
dioxus::LaunchBuilder::desktop()
.with_cfg(
Config::new().with_window(
WindowBuilder::new()
Expand Down
2 changes: 1 addition & 1 deletion examples/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use web_time::Instant;
const STYLE: &str = asset!("./examples/assets/clock.css");

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/control_focus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use dioxus::prelude::*;
const STYLE: &str = asset!("./examples/assets/roulette.css");

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use dioxus::prelude::*;
const STYLE: &str = asset!("./examples/assets/counter.css");

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/crm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use dioxus::prelude::*;

fn main() {
LaunchBuilder::new()
dioxus::LaunchBuilder::new()
.with_cfg(desktop!({
use dioxus::desktop::{LogicalSize, WindowBuilder};
dioxus::desktop::Config::default()
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ static ASSET_PATH: &str = "examples/assets/logo.png";
static ASSET_PATH: &str = asset!("examples/assets/logo.png".format(ImageType::Avif));

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use dioxus::prelude::*;

fn main() {
LaunchBuilder::new()
dioxus::LaunchBuilder::new()
.with_cfg(
dioxus::desktop::Config::new().with_custom_index(
r#"
Expand Down
2 changes: 1 addition & 1 deletion examples/custom_menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {
let config = dioxus::desktop::Config::new().with_menu(menu);

// Launch the app with the custom menu
LaunchBuilder::new().with_cfg(config).launch(app)
dioxus::LaunchBuilder::new().with_cfg(config).launch(app)
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/disabled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/dog_app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use dioxus::prelude::*;
use std::collections::HashMap;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/dynamic_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use dioxus::prelude::*;
const STYLE: &str = asset!("./examples/assets/custom_assets.css");

fn main() {
launch_desktop(app);
dioxus::LaunchBuilder::desktop().launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
use dioxus::prelude::*;

fn main() {
launch(|| rsx! { Router::<Route> {} });
dioxus::launch(|| rsx! { Router::<Route> {} });
}

/// You can use an ErrorBoundary to catch errors in children and display a warning
Expand Down
2 changes: 1 addition & 1 deletion examples/eval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use async_std::task::sleep;
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/file_upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use dioxus::{html::HasFileData, prelude::dioxus_elements::FileEngine};
const STYLE: &str = asset!("./examples/assets/file_upload.css");

fn main() {
launch(app);
dioxus::launch(app);
}

struct UploadedFile {
Expand Down
2 changes: 1 addition & 1 deletion examples/flat_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use dioxus::prelude::*;
const STYLE: &str = asset!("./examples/assets/flat_router.css");

fn main() {
launch(|| {
dioxus::launch(|| {
rsx! {
head::Link { rel: "stylesheet", href: STYLE }
Router::<Route> {}
Expand Down
2 changes: 1 addition & 1 deletion examples/form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use dioxus::prelude::*;
use std::collections::HashMap;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/fullstack-desktop/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fn main() {
// Set the url of the server where server functions are hosted.
#[cfg(not(feature = "server"))]
dioxus::fullstack::prelude::server_fn::client::set_server_url("http://127.0.0.1:8080");
launch(app);
dioxus::launch(app);
}

pub fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/fullstack-hello-world/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ fn main() {
#[cfg(feature = "server")]
tracing_subscriber::fmt::init();

launch(app);
dioxus::launch(app);
}
2 changes: 1 addition & 1 deletion examples/fullstack-router/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use dioxus::prelude::*;

fn main() {
LaunchBuilder::fullstack()
dioxus::LaunchBuilder::new()
.with_cfg(server_only!(ServeConfig::builder().incremental(
IncrementalRendererConfig::default()
.invalidate_after(std::time::Duration::from_secs(120)),
Expand Down
2 changes: 1 addition & 1 deletion examples/fullstack-streaming/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ pub async fn test_stream() -> Result<TextStream, ServerFnError> {
}

fn main() {
launch(app)
dioxus::launch(app)
}
2 changes: 1 addition & 1 deletion examples/future.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use async_std::task::sleep;
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/generic_component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use dioxus::prelude::*;
use std::fmt::Display;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ static COUNT: GlobalSignal<i32> = Signal::global(|| 0);
static DOUBLED_COUNT: GlobalMemo<i32> = Memo::global(|| COUNT() * 2);

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/hash_fragment_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use dioxus::prelude::*;
use serde::{Deserialize, Serialize};

fn main() {
launch(|| {
dioxus::launch(|| {
rsx! {
Router::<Route> {}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/hydration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use dioxus::desktop::Config;
use dioxus::prelude::*;

fn main() {
LaunchBuilder::desktop()
dioxus::LaunchBuilder::desktop()
.with_cfg(Config::new().with_prerendered({
// We build the dom a first time, then pre-render it to HTML
let pre_rendered_dom = VirtualDom::prebuilt(app);
Expand Down
2 changes: 1 addition & 1 deletion examples/image_generator_openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use serde_json::{json, Error};

fn main() {
launch(app)
dioxus::launch(app)
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use dioxus::prelude::*;
const STYLE: &str = asset!("./examples/assets/links.css");

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/login_form.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/memo_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use dioxus::prelude::*;

fn main() {
tracing_subscriber::fmt::init();
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/mobile_demo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub fn main() -> Result<()> {

// Right now we're going through dioxus-desktop but we'd like to go through dioxus-mobile
// That will seed the index.html with some fixes that prevent the page from scrolling/zooming etc
LaunchBuilder::mobile()
dioxus::LaunchBuilder::mobile()
.with_cfg(
// Note that we have to disable the viewport goofiness of the browser.
// Dioxus_mobile should do this for us
Expand Down
2 changes: 1 addition & 1 deletion examples/multiwindow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use dioxus::prelude::*;

fn main() {
launch_desktop(app);
dioxus::LaunchBuilder::desktop().launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/nested_listeners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/optional_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use dioxus::prelude::*;

fn main() {
launch(app);
dioxus::launch(app);
}

fn app() -> Element {
Expand Down
4 changes: 3 additions & 1 deletion examples/overlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ use dioxus::desktop::{
use dioxus::prelude::*;

fn main() {
LaunchBuilder::desktop().with_cfg(make_config()).launch(app);
dioxus::LaunchBuilder::desktop()
.with_cfg(make_config())
.launch(app);
}

fn app() -> Element {
Expand Down
2 changes: 1 addition & 1 deletion examples/popup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use dioxus::prelude::*;
use std::rc::Rc;

fn main() {
launch_desktop(app);
dioxus::LaunchBuilder::desktop().launch(app);
}

fn app() -> Element {
Expand Down
Loading
Loading