Skip to content

Commit

Permalink
Better handling of view cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
texodus committed Apr 26, 2021
1 parent 6fd5a10 commit 6ad7df5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion python/perspective/perspective/table/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_min_max(self, colname):
Returns:
:obj:`list` of 2 elements, the `min` and `max` of the
"""
return list(map(lambda x: scalar_to_py(x, False, False), self._view.get_min_max(colname)));
return list(map(lambda x: scalar_to_py(x, False, False), self._view.get_min_max(colname)))

def num_rows(self):
"""The number of aggregated rows in the :class:`~perspective.View`.
Expand Down
24 changes: 13 additions & 11 deletions rust/perspective-vieux/src/rust/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,21 @@ fn ignore_view_delete(f: JsValue) {
match f.clone().dyn_into::<js_sys::Error>() {
Ok(err) => {
if err.message() != "View is not initialized" {
wasm_bindgen::throw_val(f)
web_sys::console::log_1(&JsValue::from("A"));
wasm_bindgen::throw_val(f);
}
}
_ => {
if !js_sys::Reflect::has(&f, js_intern!("message")).unwrap()
|| js_sys::Reflect::get(&f, js_intern!("message"))
.unwrap()
.as_string()
.unwrap_or("".to_owned())
!= "View is not initialized"
{
wasm_bindgen::throw_val(f)
}
_ => match f.as_string() {
Some(x) if x == "View is not initialized" => {},
Some(_) => wasm_bindgen::throw_val(f),
_ => match js_sys::Reflect::has(&f, js_intern!("message")) {
Ok(true) if js_sys::Reflect::get(&f, js_intern!("message"))
.unwrap()
.as_string()
.unwrap_or("".to_owned())
== "View is not initialized" => {}
_ => wasm_bindgen::throw_val(f)
}
}
}
}
Expand Down

0 comments on commit 6ad7df5

Please sign in to comment.