Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web Eval: Use JSON Compatible Serializer #2592

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/web/src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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())),
};
Expand Down
Loading