fix fullstack playwright test features

This commit is contained in:
Evan Almloff committed 2024-02-05 15:04:49 -06:00
1 parent 1b7c31792e
commit b4f2a925c7
15 files changed
+93 -66

No files matched your search

@@ -1,2 +1,3 @@
.dioxus
dist
target
@@ -7,13 +7,10 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
dioxus = { workspace = true }
axum = { version = "0.6.12", optional = true }
tokio = { version = "1.27.0", features = ["full"], optional = true }
dioxus = { workspace = true, features = ["fullstack"] }
serde = "1.0.159"
execute = "0.2.12"
[features]
default = []
server = ["axum", "tokio", "dioxus/axum"]
server = ["dioxus/axum"]
web = ["dioxus/web"]
@@ -6,55 +6,18 @@
#![allow(non_snake_case)]
use dioxus::prelude::*;
use serde::{Deserialize, Serialize};
fn main() {
#[cfg(feature = "web")]
dioxus_web::launch_with_props(
app,
get_root_props_from_document().unwrap_or_default(),
dioxus_web::Config::new().hydrate(true),
);
#[cfg(feature = "ssr")]
{
// Start hot reloading
hot_reload_init!(dioxus_hot_reload::Config::new().with_rebuild_callback(|| {
execute::shell("dx build --features web")
.spawn()
.unwrap()
.wait()
.unwrap();
execute::shell("cargo run --features ssr").spawn().unwrap();
true
}));
tokio::runtime::Runtime::new()
.unwrap()
.block_on(async move {
let addr = std::net::SocketAddr::from(([127, 0, 0, 1], 3333));
axum::Server::bind(&addr)
.serve(
axum::Router::new()
.serve_dioxus_application(
"",
ServeConfigBuilder::new(app, AppProps { count: 12345 }).build(),
)
.into_make_service(),
)
.await
.unwrap();
});
}
}
#[derive(Props, PartialEq, Debug, Default, Serialize, Deserialize, Clone)]
struct AppProps {
count: i32,
LaunchBuilder::fullstack()
.with_cfg(ssr! {
dioxus::fullstack::Config::default().addr(std::net::SocketAddr::from(([127, 0, 0, 1], 3333)))
})
.launch(app);
}
#[allow(unused)]
fn app(props: AppProps) -> Element {
let mut count = use_signal(|| props.count);
fn app() -> Element {
let mut count = use_signal(|| 12345);
let mut text = use_signal(|| "...".to_string());
rsx! {