@yuneta/gobj-ui 7.4.2 → 7.4.4

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.
@@ -55708,6 +55708,7 @@ function refresh_minimap(gobj) {
55708
55708
  return;
55709
55709
  }
55710
55710
  if (graph_get_plugin(gobj, "minimap")) return;
55711
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: minimap: adding for ${n} nodes (threshold ${threshold})`);
55711
55712
  graph_add_plugin(gobj, "minimap", {
55712
55713
  size: [200, 140],
55713
55714
  position: "bottom-left",
@@ -55731,6 +55732,12 @@ function refresh_minimap(gobj) {
55731
55732
  }
55732
55733
  }
55733
55734
  });
55735
+ try {
55736
+ graph.draw();
55737
+ } catch (e) {
55738
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: cannot draw the minimap: ${e}`);
55739
+ }
55740
+ (0, _yuneta_gobj_js.log_warning)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: minimap: plugin is ${graph_get_plugin(gobj, "minimap") ? "up" : "MISSING"}`);
55734
55741
  }
55735
55742
  /************************************************************
55736
55743
  * The innerHTML of ONE node, in the given theme and highlight state.
@@ -56529,7 +56536,11 @@ function ac_load_data(gobj, event, kw, src) {
56529
56536
  graph_layout(gobj).then(() => {
56530
56537
  if (priv.edit_mode) graph_add_plugin(gobj, "history");
56531
56538
  else graph_remove_plugin(gobj, "history");
56532
- refresh_minimap(gobj);
56539
+ try {
56540
+ refresh_minimap(gobj);
56541
+ } catch (e) {
56542
+ (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: refresh_minimap failed: ${e}`);
56543
+ }
56533
56544
  if (priv._pending_focus_topic !== null) {
56534
56545
  let ft = priv._pending_focus_topic;
56535
56546
  priv._pending_focus_topic = null;
@@ -55695,6 +55695,7 @@ function refresh_minimap(gobj) {
55695
55695
  return;
55696
55696
  }
55697
55697
  if (graph_get_plugin(gobj, "minimap")) return;
55698
+ log_warning(`${gobj_short_name(gobj)}: minimap: adding for ${n} nodes (threshold ${threshold})`);
55698
55699
  graph_add_plugin(gobj, "minimap", {
55699
55700
  size: [200, 140],
55700
55701
  position: "bottom-left",
@@ -55718,6 +55719,12 @@ function refresh_minimap(gobj) {
55718
55719
  }
55719
55720
  }
55720
55721
  });
55722
+ try {
55723
+ graph.draw();
55724
+ } catch (e) {
55725
+ log_error(`${gobj_short_name(gobj)}: cannot draw the minimap: ${e}`);
55726
+ }
55727
+ log_warning(`${gobj_short_name(gobj)}: minimap: plugin is ${graph_get_plugin(gobj, "minimap") ? "up" : "MISSING"}`);
55721
55728
  }
55722
55729
  /************************************************************
55723
55730
  * The innerHTML of ONE node, in the given theme and highlight state.
@@ -56516,7 +56523,11 @@ function ac_load_data(gobj, event, kw, src) {
56516
56523
  graph_layout(gobj).then(() => {
56517
56524
  if (priv.edit_mode) graph_add_plugin(gobj, "history");
56518
56525
  else graph_remove_plugin(gobj, "history");
56519
- refresh_minimap(gobj);
56526
+ try {
56527
+ refresh_minimap(gobj);
56528
+ } catch (e) {
56529
+ log_error(`${gobj_short_name(gobj)}: refresh_minimap failed: ${e}`);
56530
+ }
56520
56531
  if (priv._pending_focus_topic !== null) {
56521
56532
  let ft = priv._pending_focus_topic;
56522
56533
  priv._pending_focus_topic = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.4.2",
3
+ "version": "7.4.4",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -4524,6 +4524,8 @@ function refresh_minimap(gobj)
4524
4524
  return; /* already up */
4525
4525
  }
4526
4526
 
4527
+ log_warning(`${gobj_short_name(gobj)}: minimap: adding for ${n} nodes ` +
4528
+ `(threshold ${threshold})`);
4527
4529
  graph_add_plugin(
4528
4530
  gobj,
4529
4531
  "minimap",
@@ -4556,6 +4558,18 @@ function refresh_minimap(gobj)
4556
4558
  }
4557
4559
  }
4558
4560
  );
4561
+
4562
+ /* The plugin builds its canvas on its FIRST render, and it renders off
4563
+ * the graph's draw events — which have all already happened by the time
4564
+ * the node count is known and this runs. Without a draw of its own it
4565
+ * sits there having never painted, with no container in the DOM at all. */
4566
+ try {
4567
+ graph.draw();
4568
+ } catch(e) {
4569
+ log_error(`${gobj_short_name(gobj)}: cannot draw the minimap: ${e}`);
4570
+ }
4571
+ log_warning(`${gobj_short_name(gobj)}: minimap: plugin is ` +
4572
+ `${graph_get_plugin(gobj, "minimap")? "up" : "MISSING"}`);
4559
4573
  }
4560
4574
 
4561
4575
  /************************************************************
@@ -5764,8 +5778,17 @@ function ac_load_data(gobj, event, kw, src)
5764
5778
  graph_remove_plugin(gobj, "history");
5765
5779
  }
5766
5780
  /* The graph knows its size now: a minimap appears only
5767
- * when there is something to be lost in. */
5768
- refresh_minimap(gobj);
5781
+ * when there is something to be lost in.
5782
+ *
5783
+ * Guarded because this runs inside a .then(): an
5784
+ * exception here becomes an unhandled rejection, which
5785
+ * is not a console error and not a pageerror — it is
5786
+ * nothing at all, and the feature just fails to appear. */
5787
+ try {
5788
+ refresh_minimap(gobj);
5789
+ } catch(e) {
5790
+ log_error(`${gobj_short_name(gobj)}: refresh_minimap failed: ${e}`);
5791
+ }
5769
5792
  /* Nodes exist and are positioned now: apply a focus
5770
5793
  * requested before the data was ready (deep link). */
5771
5794
  if(priv._pending_focus_topic !== null) {