From 22a5acfcb8af2961008e8a0873c53df9155a8f5e Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 14 Feb 2024 16:38:05 -0800 Subject: [PATCH] Remove SSR evalulator --- .vscode/settings.json | 1 + packages/ssr/src/eval.rs | 46 ---------------------------------------- packages/ssr/src/lib.rs | 2 -- 3 files changed, 1 insertion(+), 48 deletions(-) delete mode 100644 packages/ssr/src/eval.rs diff --git a/.vscode/settings.json b/.vscode/settings.json index ebd52887e..836fb0116 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,5 +3,6 @@ "[toml]": { "editor.formatOnSave": false }, + "rust-analyzer.check.workspace": true, "rust-analyzer.checkOnSave.allTargets": false, } diff --git a/packages/ssr/src/eval.rs b/packages/ssr/src/eval.rs deleted file mode 100644 index af9d56394..000000000 --- a/packages/ssr/src/eval.rs +++ /dev/null @@ -1,46 +0,0 @@ -use async_trait::async_trait; -use dioxus_core::ScopeId; -use dioxus_html::prelude::{EvalError, EvalProvider, Evaluator}; -use generational_box::{AnyStorage, GenerationalBox, UnsyncStorage}; -use std::rc::Rc; - -/// Provides the SSREvalProvider through [`cx.provide_context`]. -pub fn init_eval() { - let provider: Rc = Rc::new(SSREvalProvider {}); - ScopeId::ROOT.provide_context(provider); -} - -/// Reprents the ssr-target's provider of evaluators. -pub struct SSREvalProvider; -impl EvalProvider for SSREvalProvider { - fn new_evaluator(&self, _: String) -> GenerationalBox> { - let owner = UnsyncStorage::owner(); - owner.insert(Box::new(SSREvaluator) as Box) - } -} - -/// Represents a ssr-target's JavaScript evaluator. -pub struct SSREvaluator; - -// In ssr rendering we never run or resolve evals. -#[async_trait(?Send)] -impl Evaluator for SSREvaluator { - /// Sends a message to the evaluated JavaScript. - fn send(&self, _el: serde_json::Value) -> Result<(), EvalError> { - Ok(()) - } - - fn poll_recv( - &mut self, - _cx: &mut std::task::Context<'_>, - ) -> std::task::Poll> { - std::task::Poll::Pending - } - - fn poll_join( - &mut self, - _cx: &mut std::task::Context<'_>, - ) -> std::task::Poll> { - std::task::Poll::Pending - } -} diff --git a/packages/ssr/src/lib.rs b/packages/ssr/src/lib.rs index 6e3e16fd4..d80cdefea 100644 --- a/packages/ssr/src/lib.rs +++ b/packages/ssr/src/lib.rs @@ -11,7 +11,6 @@ pub mod incremental; #[cfg(feature = "incremental")] mod incremental_cfg; -pub mod eval; pub mod renderer; pub mod template; @@ -29,7 +28,6 @@ pub fn render_element(element: Element) -> String { } let mut dom = VirtualDom::new_with_props(lazy_app, element); - dom.in_runtime(crate::eval::init_eval); dom.rebuild(&mut NoOpMutations); Renderer::new().render(&dom)