Skip to content

Commit

Permalink
review + post merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ranile committed Nov 11, 2021
1 parent 9370df3 commit ff211e3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
8 changes: 6 additions & 2 deletions packages/yew-agent/src/worker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub use public::Public;
use super::*;
use js_sys::{Array, Reflect, Uint8Array};
use serde::{Deserialize, Serialize};
use wasm_bindgen::{closure::Closure, JsCast, JsValue};
use wasm_bindgen::{closure::Closure, JsCast, JsValue, UnwrapThrowExt};
use web_sys::{
Blob, BlobPropertyBag, DedicatedWorkerGlobalScope, MessageEvent, Url, Worker, WorkerOptions,
};
Expand Down Expand Up @@ -71,7 +71,11 @@ where
}

fn worker_new(name_of_resource: &str, is_module: bool) -> Worker {
let origin = gloo_utils::document().location().unwrap().origin().unwrap();
let origin = gloo_utils::document()
.location()
.unwrap_throw()
.origin()
.unwrap_throw();
let script_url = format!("{}/{}", origin, name_of_resource);
let wasm_url = format!("{}/{}", origin, name_of_resource.replace(".js", "_bg.wasm"));
let array = Array::new();
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-router/src/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ use std::cell::RefCell;
use std::rc::{Rc, Weak};

use gloo::events::EventListener;
use gloo_utils::window;
use serde::de::DeserializeOwned;
use serde::Serialize;
use thiserror::Error;
use wasm_bindgen::{JsValue, UnwrapThrowExt};
use yew::callback::Callback;
use yew::utils::window;

use crate::utils::base_url;
use crate::Routable;
Expand Down
1 change: 0 additions & 1 deletion packages/yew-router/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pub fn fetch_base_url() -> Option<String> {
mod tests {
use gloo_utils::document;
use wasm_bindgen_test::wasm_bindgen_test as test;
use yew::utils::*;
use yew_router::prelude::*;
use yew_router::utils::*;

Expand Down
11 changes: 6 additions & 5 deletions packages/yew/tests/use_reducer.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::collections::HashSet;
use std::rc::Rc;

use gloo_utils::document;
use wasm_bindgen::JsCast;
use wasm_bindgen_test::*;
use web_sys::HtmlElement;
Expand Down Expand Up @@ -116,13 +117,13 @@ fn use_reducer_eq_works() {
}
type UseReducerComponent = FunctionComponent<UseReducerFunction>;
yew::start_app_in_element::<UseReducerComponent>(
yew::utils::document().get_element_by_id("output").unwrap(),
document().get_element_by_id("output").unwrap(),
);

let result = obtain_result();
assert_eq!(result.as_str(), "1");

yew::utils::document()
document()
.get_element_by_id("add-a")
.unwrap()
.unchecked_into::<HtmlElement>()
Expand All @@ -131,7 +132,7 @@ fn use_reducer_eq_works() {
let result = obtain_result();
assert_eq!(result.as_str(), "2");

yew::utils::document()
document()
.get_element_by_id("add-a")
.unwrap()
.unchecked_into::<HtmlElement>()
Expand All @@ -140,7 +141,7 @@ fn use_reducer_eq_works() {
let result = obtain_result();
assert_eq!(result.as_str(), "2");

yew::utils::document()
document()
.get_element_by_id("add-b")
.unwrap()
.unchecked_into::<HtmlElement>()
Expand All @@ -149,7 +150,7 @@ fn use_reducer_eq_works() {
let result = obtain_result();
assert_eq!(result.as_str(), "3");

yew::utils::document()
document()
.get_element_by_id("add-b")
.unwrap()
.unchecked_into::<HtmlElement>()
Expand Down

0 comments on commit ff211e3

Please sign in to comment.