@perspective-dev/viewer 4.1.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -124,7 +124,13 @@ impl PerspectiveViewerElement {
124
124
  clone!(renderer, session);
125
125
  move |_| {
126
126
  clone!(renderer, session);
127
- ApiFuture::spawn(async move { renderer.update(session.get_view()).await })
127
+ ApiFuture::spawn(async move {
128
+ renderer
129
+ .update(session.get_view())
130
+ .await
131
+ .ignore_view_delete()
132
+ .map(|_| ())
133
+ })
128
134
  }
129
135
  });
130
136
 
@@ -256,7 +262,7 @@ impl PerspectiveViewerElement {
256
262
  self.session.update_view_config(config)?;
257
263
 
258
264
  clone!(self.renderer, self.session);
259
- Ok(ApiFuture::new(async move {
265
+ Ok(ApiFuture::new_throttled(async move {
260
266
  let task = async {
261
267
  // Ignore this error, which is blown away by the table anyway.
262
268
  let _ = task.await;
@@ -340,9 +346,9 @@ impl PerspectiveViewerElement {
340
346
  );
341
347
 
342
348
  std::mem::swap(self, &mut state);
343
- ApiFuture::new(state.delete())
349
+ ApiFuture::new_throttled(state.delete())
344
350
  } else {
345
- ApiFuture::new(async move { Ok(()) })
351
+ ApiFuture::new_throttled(async move { Ok(()) })
346
352
  }
347
353
  }
348
354
 
@@ -481,7 +487,7 @@ impl PerspectiveViewerElement {
481
487
  /// ```
482
488
  pub fn flush(&self) -> ApiFuture<()> {
483
489
  clone!(self.renderer);
484
- ApiFuture::new(async move {
490
+ ApiFuture::new_throttled(async move {
485
491
  // We must let two AFs pass to guarantee listeners to the DOM state
486
492
  // have themselves triggered, or else `request_animation_frame`
487
493
  // may finish before a `ResizeObserver` triggered before is
@@ -527,7 +533,7 @@ impl PerspectiveViewerElement {
527
533
  /// ```
528
534
  pub fn restore(&self, update: JsValue) -> ApiFuture<()> {
529
535
  let this = self.clone();
530
- ApiFuture::new(async move {
536
+ ApiFuture::new_throttled(async move {
531
537
  let decoded_update = ViewerConfigUpdate::decode(&update)?;
532
538
  tracing::info!("Restoring {}", decoded_update);
533
539
  let root = this.root.clone();
@@ -568,7 +574,7 @@ impl PerspectiveViewerElement {
568
574
  pub fn resetError(&self) -> ApiFuture<()> {
569
575
  ApiFuture::spawn(self.session.reset(ResetOptions::default()));
570
576
  let this = self.clone();
571
- ApiFuture::new(async move {
577
+ ApiFuture::new_throttled(async move {
572
578
  this.update_and_render(ViewConfigUpdate::default())?.await?;
573
579
  Ok(())
574
580
  })
@@ -622,7 +628,7 @@ impl PerspectiveViewerElement {
622
628
  /// ```
623
629
  pub fn download(&self, method: Option<JsString>) -> ApiFuture<()> {
624
630
  let this = self.clone();
625
- ApiFuture::new(async move {
631
+ ApiFuture::new_throttled(async move {
626
632
  let method = if let Some(method) = method
627
633
  .map(|x| x.unchecked_into())
628
634
  .map(serde_wasm_bindgen::from_value)
@@ -692,7 +698,7 @@ impl PerspectiveViewerElement {
692
698
  /// ```
693
699
  pub fn copy(&self, method: Option<JsString>) -> ApiFuture<()> {
694
700
  let this = self.clone();
695
- ApiFuture::new(async move {
701
+ ApiFuture::new_throttled(async move {
696
702
  let method = if let Some(method) = method
697
703
  .map(|x| x.unchecked_into())
698
704
  .map(serde_wasm_bindgen::from_value)
@@ -723,7 +729,7 @@ impl PerspectiveViewerElement {
723
729
  tracing::debug!("Resetting config");
724
730
  let root = self.root.clone();
725
731
  let all = reset_all.unwrap_or_default();
726
- ApiFuture::new(async move {
732
+ ApiFuture::new_throttled(async move {
727
733
  let (sender, receiver) = channel::<()>();
728
734
  root.borrow()
729
735
  .as_ref()
@@ -763,7 +769,7 @@ impl PerspectiveViewerElement {
763
769
  }
764
770
 
765
771
  let state = self.clone_state();
766
- ApiFuture::new(async move {
772
+ ApiFuture::new_throttled(async move {
767
773
  if !state.renderer().is_plugin_activated()? {
768
774
  state
769
775
  .update_and_render(ViewConfigUpdate::default())?
@@ -1031,7 +1037,7 @@ impl PerspectiveViewerElement {
1031
1037
  #[wasm_bindgen]
1032
1038
  pub fn toggleColumnSettings(&self, column_name: String) -> ApiFuture<()> {
1033
1039
  clone!(self.session, self.root);
1034
- ApiFuture::new(async move {
1040
+ ApiFuture::new_throttled(async move {
1035
1041
  let locator = session.get_column_locator(Some(column_name));
1036
1042
  let (sender, receiver) = channel::<()>();
1037
1043
  root.borrow().as_ref().into_apierror()?.send_message(
@@ -1056,7 +1062,7 @@ impl PerspectiveViewerElement {
1056
1062
  ) -> ApiFuture<()> {
1057
1063
  let locator = self.get_column_locator(column_name);
1058
1064
  clone!(self.root);
1059
- ApiFuture::new(async move {
1065
+ ApiFuture::new_throttled(async move {
1060
1066
  let (sender, receiver) = channel::<()>();
1061
1067
  root.borrow().as_ref().into_apierror()?.send_message(
1062
1068
  PerspectiveViewerMsg::OpenColumnSettings {