fix: fix web-sys warnings in server_fn (#2828)

* fix: fix web-sys warnings in server_fn

* fix: update web-sys to 0.3.70

* fix: web-sys clipboard api in 0.3.70
This commit is contained in:
Saber Haj Rabiee 2024-08-13 15:46:34 -07:00 committed by GitHub
parent 3f751551a8
commit db1c15f4e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 31 additions and 33 deletions

View file

@ -18,4 +18,4 @@ gloo-timers = { version = "0.3.0", features = ["futures"] }
[dev-dependencies] [dev-dependencies]
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
wasm-bindgen-test = "0.3.42" wasm-bindgen-test = "0.3.42"
web-sys = "0.3.69" web-sys = "0.3.70"

View file

@ -15,4 +15,4 @@ console_error_panic_hook = "0.1.7"
[dev-dependencies] [dev-dependencies]
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
wasm-bindgen-test = "0.3.42" wasm-bindgen-test = "0.3.42"
web-sys = "0.3.69" web-sys = "0.3.70"

View file

@ -20,4 +20,4 @@ rstest = "0.22.0"
[dev-dependencies.web-sys] [dev-dependencies.web-sys]
features = ["HtmlElement", "XPathResult"] features = ["HtmlElement", "XPathResult"]
version = "0.3.69" version = "0.3.70"

View file

@ -10,4 +10,4 @@ console_error_panic_hook = "0.1.7"
[dev-dependencies] [dev-dependencies]
wasm-bindgen-test = "0.3.42" wasm-bindgen-test = "0.3.42"
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
web-sys = "0.3.69" web-sys = "0.3.70"

View file

@ -8,9 +8,9 @@ leptos = { path = "../../leptos", features = ["csr"] }
log = "0.4.22" log = "0.4.22"
console_log = "1.0" console_log = "1.0"
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
web-sys = { version = "0.3.69", features = ["Clipboard", "Navigator"] } web-sys = { version = "0.3.70", features = ["Clipboard", "Navigator"] }
[dev-dependencies] [dev-dependencies]
wasm-bindgen-test = "0.3.42" wasm-bindgen-test = "0.3.42"
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
web-sys = { version = "0.3.69", features = ["NodeList"] } web-sys = { version = "0.3.70", features = ["NodeList"] }

View file

@ -24,11 +24,7 @@ pub fn copy_to_clipboard(el: Element, content: &str) {
evt.prevent_default(); evt.prevent_default();
evt.stop_propagation(); evt.stop_propagation();
let _ = window() let _ = window().navigator().clipboard().write_text(&content);
.navigator()
.clipboard()
.expect("navigator.clipboard to be available")
.write_text(&content);
el.set_inner_html(&format!("Copied \"{}\"", &content)); el.set_inner_html(&format!("Copied \"{}\"", &content));
}); });

View file

@ -26,7 +26,7 @@ serde = { version = "1.0", features = ["derive"] }
gloo-net = { version = "0.6.0", features = ["http"] } gloo-net = { version = "0.6.0", features = ["http"] }
reqwest = { version = "0.12.5", features = ["json"] } reqwest = { version = "0.12.5", features = ["json"] }
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
web-sys = { version = "0.3.69", features = ["AbortController", "AbortSignal"] } web-sys = { version = "0.3.70", features = ["AbortController", "AbortSignal"] }
send_wrapper = "0.6.0" send_wrapper = "0.6.0"
[features] [features]

View file

@ -25,7 +25,7 @@ tower = { version = "0.4.13", optional = true }
tower-http = { version = "0.5.2", features = ["fs"], optional = true } tower-http = { version = "0.5.2", features = ["fs"], optional = true }
tokio = { version = "1.39", features = ["full"], optional = true } tokio = { version = "1.39", features = ["full"], optional = true }
http = { version = "1.1", optional = true } http = { version = "1.1", optional = true }
web-sys = { version = "0.3.69", features = ["AbortController", "AbortSignal"] } web-sys = { version = "0.3.70", features = ["AbortController", "AbortSignal"] }
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
send_wrapper = { version = "0.6.0", features = ["futures"] } send_wrapper = { version = "0.6.0", features = ["futures"] }

View file

@ -29,7 +29,7 @@ tower-http = { version = "0.5.2", features = [
], optional = true } ], optional = true }
tokio = { version = "1.39", features = ["full"], optional = true } tokio = { version = "1.39", features = ["full"], optional = true }
http = { version = "1.1", optional = true } http = { version = "1.1", optional = true }
web-sys = { version = "0.3.69", features = ["AbortController", "AbortSignal"] } web-sys = { version = "0.3.70", features = ["AbortController", "AbortSignal"] }
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
lazy_static = "1.5" lazy_static = "1.5"
rust-embed = { version = "8.5", features = [ rust-embed = { version = "8.5", features = [

View file

@ -26,7 +26,7 @@ reqwest = { version = "0.12.5", features = ["json"] }
axum = { version = "0.7.5", default-features = false, optional = true } axum = { version = "0.7.5", default-features = false, optional = true }
tower = { version = "0.4.13", optional = true } tower = { version = "0.4.13", optional = true }
http = { version = "1.1", optional = true } http = { version = "1.1", optional = true }
web-sys = { version = "0.3.69", features = [ web-sys = { version = "0.3.70", features = [
"AbortController", "AbortController",
"AbortSignal", "AbortSignal",
"Request", "Request",

View file

@ -12,4 +12,4 @@ leptos = { path = "../../leptos", features = ["csr"] }
console_log = "1.0" console_log = "1.0"
log = "0.4.22" log = "0.4.22"
console_error_panic_hook = "0.1.7" console_error_panic_hook = "0.1.7"
web-sys = "0.3.69" web-sys = "0.3.70"

View file

@ -13,4 +13,4 @@ wasm-bindgen = "0.2.93"
[dev-dependencies] [dev-dependencies]
wasm-bindgen-test = "0.3.42" wasm-bindgen-test = "0.3.42"
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
web-sys = "0.3.69" web-sys = "0.3.70"

View file

@ -32,7 +32,7 @@ thiserror = "1.0"
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
serde_toml = "0.0.1" serde_toml = "0.0.1"
toml = "0.8.19" toml = "0.8.19"
web-sys = { version = "0.3.69", features = ["FileList", "File"] } web-sys = { version = "0.3.70", features = ["FileList", "File"] }
strum = { version = "0.26.3", features = ["strum_macros", "derive"] } strum = { version = "0.26.3", features = ["strum_macros", "derive"] }
notify = { version = "6.1", optional = true } notify = { version = "6.1", optional = true }
pin-project-lite = "0.2.14" pin-project-lite = "0.2.14"

View file

@ -17,4 +17,4 @@ console_error_panic_hook = "0.1.7"
[dev-dependencies] [dev-dependencies]
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
wasm-bindgen-test = "0.3.42" wasm-bindgen-test = "0.3.42"
web-sys = "0.3.69" web-sys = "0.3.70"

View file

@ -15,7 +15,7 @@ console_error_panic_hook = "0.1.7"
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
[dependencies.web-sys] [dependencies.web-sys]
version = "0.3.69" version = "0.3.70"
features = ["Window"] features = ["Window"]
[dev-dependencies] [dev-dependencies]

View file

@ -13,7 +13,7 @@ console_error_panic_hook = "0.1.7"
uuid = { version = "1.10", features = ["v4", "js", "serde"] } uuid = { version = "1.10", features = ["v4", "js", "serde"] }
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
web-sys = { version = "0.3.69", features = ["Storage"] } web-sys = { version = "0.3.70", features = ["Storage"] }
[dev-dependencies] [dev-dependencies]
wasm-bindgen-test = "0.3.42" wasm-bindgen-test = "0.3.42"

View file

@ -40,7 +40,7 @@ server_fn = { workspace = true, features = [
"browser", "browser",
"url", "url",
] } ] }
web-sys = { version = "0.3.69", features = [ web-sys = { version = "0.3.70", features = [
"ShadowRoot", "ShadowRoot",
"ShadowRootInit", "ShadowRootInit",
"ShadowRootMode", "ShadowRootMode",

View file

@ -21,7 +21,7 @@ wasm-bindgen = "0.2.93"
leptos = { path = "../leptos" } leptos = { path = "../leptos" }
[dependencies.web-sys] [dependencies.web-sys]
version = "0.3.69" version = "0.3.70"
features = ["Location"] features = ["Location"]
[features] [features]

View file

@ -19,7 +19,7 @@ wasm-bindgen = "0.2.93"
futures = "0.3.30" futures = "0.3.30"
[dependencies.web-sys] [dependencies.web-sys]
version = "0.3.69" version = "0.3.70"
features = ["HtmlLinkElement", "HtmlMetaElement", "HtmlTitleElement"] features = ["HtmlLinkElement", "HtmlMetaElement", "HtmlTitleElement"]
[features] [features]

View file

@ -25,7 +25,7 @@ async-lock = "3.4.0"
send_wrapper = { version = "0.6.0", features = ["futures"] } send_wrapper = { version = "0.6.0", features = ["futures"] }
[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies] [target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
web-sys = "0.3.69" web-sys = "0.3.70"
[dev-dependencies] [dev-dependencies]
tokio = { version = "1.39", features = ["rt-multi-thread", "macros"] } tokio = { version = "1.39", features = ["rt-multi-thread", "macros"] }

View file

@ -30,7 +30,7 @@ percent-encoding = { version = "2.3", optional = true }
gloo-net = "0.6.0" gloo-net = "0.6.0"
[dependencies.web-sys] [dependencies.web-sys]
version = "0.3.69" version = "0.3.70"
features = [ features = [
"Document", "Document",
"Window", "Window",

View file

@ -63,7 +63,7 @@ js-sys = { version = "0.3.69", optional = true }
wasm-bindgen = { version = "0.2.93", optional = true } wasm-bindgen = { version = "0.2.93", optional = true }
wasm-bindgen-futures = { version = "0.4.42", optional = true } wasm-bindgen-futures = { version = "0.4.42", optional = true }
wasm-streams = { version = "0.4.0", optional = true } wasm-streams = { version = "0.4.0", optional = true }
web-sys = { version = "0.3.69", optional = true, features = [ web-sys = { version = "0.3.70", optional = true, features = [
"console", "console",
"ReadableStream", "ReadableStream",
"ReadableStreamDefaultReader", "ReadableStreamDefaultReader",

View file

@ -237,14 +237,16 @@ fn streaming_request(
Ok(data) as Result<JsValue, JsValue> Ok(data) as Result<JsValue, JsValue>
})) }))
.into_raw(); .into_raw();
let headers = Headers::new()?; let headers = Headers::new()?;
headers.append("Content-Type", content_type)?; headers.append("Content-Type", content_type)?;
headers.append("Accept", accepts)?; headers.append("Accept", accepts)?;
let mut init = RequestInit::new();
init.headers(&headers) let init = RequestInit::new();
.method("POST") init.set_headers(&headers);
.signal(abort_signal.as_ref()) init.set_method("POST");
.body(Some(&stream)); init.set_signal(abort_signal.as_ref());
init.set_body(&stream);
// Chrome requires setting `duplex: "half"` on streaming requests // Chrome requires setting `duplex: "half"` on streaming requests
Reflect::set( Reflect::set(

View file

@ -25,7 +25,7 @@ pin-project-lite = "0.2.14"
wasm-bindgen = "0.2.93" wasm-bindgen = "0.2.93"
html-escape = "0.2.13" html-escape = "0.2.13"
js-sys = "0.3.69" js-sys = "0.3.69"
web-sys = { version = "0.3.69", features = [ web-sys = { version = "0.3.70", features = [
"Window", "Window",
"Document", "Document",
"HtmlElement", "HtmlElement",