More fullstack fixes (#4737)

* allow `--server` only builds!

* rollback example

* capture `/:route` routes

* fix: properly implement file uploads in forms

* implement desktop form uploads

* Performant serialization of form bytes

* finish up file stuff

* cleanups

* add request headers to streaming context

* remove some unwraps
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-10-07 23:07:43 -07:00
1 parent fc01a002fd
commit 92792aded9
47 files changed
+1241 -703

No files matched your search

+1 -33
View File
@@ -2,17 +2,14 @@ use crate::{
config::{Config, WindowCloseBehaviour},
edits::EditWebsocket,
event_handlers::WindowEventHandlers,
file_upload::{DesktopFileUploadForm, FileDialogRequest},
ipc::{IpcMessage, UserWindowEvent},
query::QueryResult,
shortcut::ShortcutRegistry,
webview::{PendingWebview, WebviewInstance},
};
use dioxus_core::{consume_context, ElementId, ScopeId, VirtualDom};
use dioxus_core::{consume_context, ScopeId, VirtualDom};
use dioxus_history::History;
use dioxus_html::PlatformEventData;
use std::{
any::Any,
cell::{Cell, RefCell},
collections::HashMap,
rc::Rc,
@@ -409,35 +406,6 @@ impl App {
}
}
pub fn handle_file_dialog_msg(&mut self, msg: IpcMessage, window: WindowId) {
let Ok(file_dialog) = serde_json::from_value::<FileDialogRequest>(msg.params()) else {
return;
};
let id = ElementId(file_dialog.target);
let event_name = &file_dialog.event;
let event_bubbles = file_dialog.bubbles;
let files = file_dialog.get_file_event();
let as_any = Box::new(DesktopFileUploadForm { files });
let data = Rc::new(PlatformEventData::new(as_any));
let Some(view) = self.webviews.get_mut(&window) else {
return;
};
let event = dioxus_core::Event::new(data as Rc<dyn Any>, event_bubbles);
let runtime = view.dom.runtime();
if event_name == "change&input" {
runtime.handle_event("input", event.clone(), id);
runtime.handle_event("change", event, id);
} else {
runtime.handle_event(event_name, event, id);
}
}
/// Poll the virtualdom until it's pending
///
/// The waker we give it is connected to the event loop, so it will wake up the event loop when it's ready to be polled again