revision: use JSON compatible serializer (#2592)

This commit is contained in:
Miles Murgaw 2024-07-23 17:36:37 -04:00 committed by GitHub
parent 9ca5396343
commit 4ccd9ffe19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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::<serde_json::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())),
};