change config flags from ssr to server to match the features

This commit is contained in:
Evan Almloff committed 2024-02-05 14:20:15 -06:00
1 parent 69e4ebe4ed
commit b63c14fab8
20 files changed
+80 -80

No files matched your search

@@ -9,7 +9,7 @@
//! fn main() {
//! #[cfg(feature = "web")]
//! dioxus_web::launch_cfg(app, dioxus_web::Config::new().hydrate(true));
//! #[cfg(feature = "ssr")]
//! #[cfg(feature = "server")]
//! {
//! tokio::runtime::Runtime::new()
//! .unwrap()
@@ -332,13 +332,13 @@ impl warp::reject::Reject for RecieveFailed {}
/// ```
pub fn connect_hot_reload() -> impl Filter<Extract = (impl Reply,), Error = warp::Rejection> + Clone
{
#[cfg(not(all(debug_assertions, feature = "hot-reload", feature = "ssr")))]
#[cfg(not(all(debug_assertions, feature = "hot-reload", feature = "server")))]
{
warp::path!("_dioxus" / "hot_reload")
.map(warp::reply)
.map(|reply| warp::reply::with_status(reply, warp::http::StatusCode::NOT_FOUND))
}
#[cfg(all(debug_assertions, feature = "hot-reload", feature = "ssr"))]
#[cfg(all(debug_assertions, feature = "hot-reload", feature = "server"))]
{
use crate::hot_reload::HotReloadState;
use futures_util::sink::SinkExt;
@@ -349,7 +349,7 @@ pub fn connect_hot_reload() -> impl Filter<Extract = (impl Reply,), Error = warp
.and(warp::any().then(crate::hot_reload::spawn_hot_reload))
.and(warp::ws())
.map(move |state: &'static HotReloadState, ws: warp::ws::Ws| {
#[cfg(all(debug_assertions, feature = "hot-reload", feature = "ssr"))]
#[cfg(all(debug_assertions, feature = "hot-reload", feature = "server"))]
ws.on_upgrade(move |mut websocket| {
async move {
println!("🔥 Hot Reload WebSocket connected");
@@ -393,7 +393,7 @@ pub fn connect_hot_reload() -> impl Filter<Extract = (impl Reply,), Error = warp
.and(warp::ws())
.map(move |ws: warp::ws::Ws| {
println!("disconnect");
#[cfg(all(debug_assertions, feature = "hot-reload", feature = "ssr"))]
#[cfg(all(debug_assertions, feature = "hot-reload", feature = "server"))]
ws.on_upgrade(move |mut websocket| async move {
struct DisconnectOnDrop(Option<warp::ws::WebSocket>);
impl Drop for DisconnectOnDrop {