From 4ccd9ffe19813c41a192b994d0ab56695fc2d983 Mon Sep 17 00:00:00 2001 From: Miles Murgaw Date: Tue, 23 Jul 2024 17:36:37 -0400 Subject: [PATCH] revision: use JSON compatible serializer (#2592) --- packages/web/src/document.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/web/src/document.rs b/packages/web/src/document.rs index 3efedf050..38091e04d 100644 --- a/packages/web/src/document.rs +++ b/packages/web/src/document.rs @@ -4,6 +4,7 @@ use dioxus_html::document::{ }; use generational_box::{AnyStorage, GenerationalBox, UnsyncStorage}; use js_sys::Function; +use serde::Serialize; use serde_json::Value; use std::future::Future; use std::pin::Pin; @@ -109,7 +110,9 @@ impl Evaluator for WebEvaluator { /// Sends a message to the evaluated JavaScript. fn send(&self, data: serde_json::Value) -> Result<(), EvalError> { - let data = match serde_wasm_bindgen::to_value::(&data) { + let serializer = serde_wasm_bindgen::Serializer::json_compatible(); + + let data = match data.serialize(&serializer) { Ok(d) => d, Err(e) => return Err(EvalError::Communication(e.to_string())), };