fix fullstack send bound

This commit is contained in:
Evan Almloff committed 2024-01-17 15:46:29 -06:00
1 parent dab87c0144
commit 499e81fa82
9 files changed
+74 -69

No files matched your search

+5 -4
View File
@@ -10,6 +10,7 @@ use crate::{
webview::WebviewInstance,
};
use crossbeam_channel::Receiver;
use dioxus_core::AnyProps;
use dioxus_core::{CrossPlatformConfig, ElementId};
use dioxus_html::{
native_bind::NativeFileEngine, FileEngine, HasFileData, HasFormData, HtmlEvent,
@@ -28,10 +29,10 @@ use tao::{
};
/// The single top-level object that manages all the running windows, assets, shortcuts, etc
pub(crate) struct App {
pub(crate) struct App<P: AnyProps> {
// move the props into a cell so we can pop it out later to create the first window
// iOS panics if we create a window before the event loop is started, so we toss them into a cell
pub(crate) dioxus_config: Cell<Option<CrossPlatformConfig>>,
pub(crate) dioxus_config: Cell<Option<CrossPlatformConfig<P>>>,
pub(crate) cfg: Cell<Option<Config>>,
// Stuff we need mutable access to
@@ -58,10 +59,10 @@ pub struct SharedContext {
pub(crate) target: EventLoopWindowTarget<UserWindowEvent>,
}
impl App {
impl<P: AnyProps> App<P> {
pub fn new(
cfg: Config,
dioxus_config: CrossPlatformConfig,
dioxus_config: CrossPlatformConfig<P>,
) -> (EventLoop<UserWindowEvent>, Self) {
let event_loop = EventLoopBuilder::<UserWindowEvent>::with_user_event().build();
+6 -3
View File
@@ -10,7 +10,10 @@ use tao::event::{Event, StartCause, WindowEvent};
///
/// This will block the main thread, and *must* be spawned on the main thread. This function does not assume any runtime
/// and is equivalent to calling launch_with_props with the tokio feature disabled.
pub fn launch_with_props_blocking(dioxus_cfg: CrossPlatformConfig, desktop_config: Config) {
pub fn launch_with_props_blocking<P: AnyProps>(
dioxus_cfg: CrossPlatformConfig<P>,
desktop_config: Config,
) {
let (event_loop, mut app) = App::new(desktop_config, dioxus_cfg);
event_loop.run(move |window_event, _, control_flow| {
@@ -50,10 +53,10 @@ pub fn launch_with_props_blocking(dioxus_cfg: CrossPlatformConfig, desktop_confi
/// The desktop renderer platform
pub struct DesktopPlatform;
impl PlatformBuilder for DesktopPlatform {
impl<P: AnyProps> PlatformBuilder<P> for DesktopPlatform {
type Config = Config;
fn launch(config: dioxus_core::CrossPlatformConfig, platform_config: Self::Config) {
fn launch(config: dioxus_core::CrossPlatformConfig<P>, platform_config: Self::Config) {
#[cfg(feature = "tokio")]
tokio::runtime::Builder::new_multi_thread()
.enable_all()