@yuneta/gobj-ui 7.23.162 → 7.23.163

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.
package/README.md CHANGED
@@ -861,6 +861,19 @@ C_YUI_TREEDB_TOPIC_WITH_FORM C_YUI_TREEDB_TOPICS
861
861
  "which topic" dialog. All three are input events; `EV_OPEN_LINKED` is the one
862
862
  output event, and `C_YUI_TREEDB_TOPICS` declares it.
863
863
 
864
+ **The table loads a hook as its count** (since `7.23.163`). Its three loads
865
+ ask with `hook_size`, so a hook arrives as `[{"size": N}]` and not as the ids
866
+ of its children, which nothing in the table reads any more:
867
+
868
+ ```js
869
+ const TABLE_READ_OPTIONS = {list_dict: true, hook_size: true};
870
+ ```
871
+
872
+ The node events still carry whole hooks, so after a live update a row can
873
+ hold the list again; the cell and a delete's question count either shape. The
874
+ search box no longer finds a parent row by the id of one of its children: to
875
+ find what hangs from a row, click its hook.
876
+
864
877
  ### Read-only treedbs: `readonly`
865
878
 
866
879
  `C_YUI_TREEDB_TOPICS` and `C_YUI_TREEDB_GRAPH` take a **`readonly`** attr; the
@@ -23057,6 +23057,10 @@ function nodes_answer(data) {
23057
23057
  * Constants
23058
23058
  ***************************************************************/
23059
23059
  var GCLASS_NAME$6 = "C_YUI_TREEDB_TOPICS";
23060
+ var TABLE_READ_OPTIONS = {
23061
+ list_dict: true,
23062
+ hook_size: true
23063
+ };
23060
23064
  /***************************************************************
23061
23065
  * Data
23062
23066
  ***************************************************************/
@@ -24089,7 +24093,7 @@ function get_nodes$1(gobj, topic_name) {
24089
24093
  subscribe_treedb$1(gobj, topic_name);
24090
24094
  let gobj_topic_form = get_gobj_formtable(gobj, topic_name);
24091
24095
  if (gobj_topic_form && (0, _yuneta_gobj_js.gobj_read_bool_attr)(gobj_topic_form, "with_remote_paging")) return;
24092
- treedb_nodes$1(gobj, treedb_name, topic_name, { list_dict: true });
24096
+ treedb_nodes$1(gobj, treedb_name, topic_name, Object.assign({}, TABLE_READ_OPTIONS));
24093
24097
  }
24094
24098
  /************************************************************
24095
24099
  *
@@ -24672,7 +24676,7 @@ function ac_request_page(gobj, event, kw, src) {
24672
24676
  (0, _yuneta_gobj_js.log_error)(`${(0, _yuneta_gobj_js.gobj_short_name)(gobj)}: a page request with no topic or no id`);
24673
24677
  return -1;
24674
24678
  }
24675
- if (treedb_nodes$1(gobj, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name"), topic_name, { list_dict: true }, {
24679
+ if (treedb_nodes$1(gobj, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name"), topic_name, Object.assign({}, TABLE_READ_OPTIONS), {
24676
24680
  from: kw.from,
24677
24681
  limit: kw.limit,
24678
24682
  req_id: kw.req_id
@@ -24826,7 +24830,8 @@ function ac_refresh_topic(gobj, event, kw, src) {
24826
24830
  (0, _yuneta_gobj_js.gobj_send_event)(gobj_topic_form, "EV_REPULL_PAGE", {}, gobj);
24827
24831
  return 0;
24828
24832
  }
24829
- treedb_nodes$1(gobj, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name"), kw.topic_name, { list_dict: true });
24833
+ let options = Object.assign({}, TABLE_READ_OPTIONS);
24834
+ treedb_nodes$1(gobj, (0, _yuneta_gobj_js.gobj_read_str_attr)(gobj, "treedb_name"), kw.topic_name, options);
24830
24835
  return 0;
24831
24836
  }
24832
24837
  /********************************************
@@ -23052,6 +23052,10 @@ function nodes_answer(data) {
23052
23052
  * Constants
23053
23053
  ***************************************************************/
23054
23054
  var GCLASS_NAME$6 = "C_YUI_TREEDB_TOPICS";
23055
+ var TABLE_READ_OPTIONS = {
23056
+ list_dict: true,
23057
+ hook_size: true
23058
+ };
23055
23059
  /***************************************************************
23056
23060
  * Data
23057
23061
  ***************************************************************/
@@ -24084,7 +24088,7 @@ function get_nodes$1(gobj, topic_name) {
24084
24088
  subscribe_treedb$1(gobj, topic_name);
24085
24089
  let gobj_topic_form = get_gobj_formtable(gobj, topic_name);
24086
24090
  if (gobj_topic_form && gobj_read_bool_attr(gobj_topic_form, "with_remote_paging")) return;
24087
- treedb_nodes$1(gobj, treedb_name, topic_name, { list_dict: true });
24091
+ treedb_nodes$1(gobj, treedb_name, topic_name, Object.assign({}, TABLE_READ_OPTIONS));
24088
24092
  }
24089
24093
  /************************************************************
24090
24094
  *
@@ -24667,7 +24671,7 @@ function ac_request_page(gobj, event, kw, src) {
24667
24671
  log_error(`${gobj_short_name(gobj)}: a page request with no topic or no id`);
24668
24672
  return -1;
24669
24673
  }
24670
- if (treedb_nodes$1(gobj, gobj_read_str_attr(gobj, "treedb_name"), topic_name, { list_dict: true }, {
24674
+ if (treedb_nodes$1(gobj, gobj_read_str_attr(gobj, "treedb_name"), topic_name, Object.assign({}, TABLE_READ_OPTIONS), {
24671
24675
  from: kw.from,
24672
24676
  limit: kw.limit,
24673
24677
  req_id: kw.req_id
@@ -24821,7 +24825,8 @@ function ac_refresh_topic(gobj, event, kw, src) {
24821
24825
  gobj_send_event(gobj_topic_form, "EV_REPULL_PAGE", {}, gobj);
24822
24826
  return 0;
24823
24827
  }
24824
- treedb_nodes$1(gobj, gobj_read_str_attr(gobj, "treedb_name"), kw.topic_name, { list_dict: true });
24828
+ let options = Object.assign({}, TABLE_READ_OPTIONS);
24829
+ treedb_nodes$1(gobj, gobj_read_str_attr(gobj, "treedb_name"), kw.topic_name, options);
24825
24830
  return 0;
24826
24831
  }
24827
24832
  /********************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "7.23.162",
3
+ "version": "7.23.163",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",
@@ -74,6 +74,21 @@ import {t} from "i18next";
74
74
  ***************************************************************/
75
75
  const GCLASS_NAME = "C_YUI_TREEDB_TOPICS";
76
76
 
77
+ /*
78
+ * How a topic TABLE reads its rows. `hook_size`: a hook comes back as
79
+ * its COUNT, `[{"size": N}]`, not as the id of every child. The cell
80
+ * only ever showed the number, and a click on it opens the child topic
81
+ * filtered (EV_OPEN_LINKED) -- so the ids were downloaded for nothing:
82
+ * every device id, once per device type, on every load of that topic.
83
+ *
84
+ * Only the table LOADS use it. The writes keep their own options, and
85
+ * the node events still carry whole hooks (c_node publishes them with
86
+ * `list_dict`, whatever a reader asked for); the cell counts either
87
+ * shape (`treedb_hook_data_size`), and so does a delete's question
88
+ * (`delete_impact`'s ref_count).
89
+ */
90
+ const TABLE_READ_OPTIONS = {list_dict: true, hook_size: true};
91
+
77
92
  /***************************************************************
78
93
  * Data
79
94
  ***************************************************************/
@@ -1316,9 +1331,7 @@ function get_nodes(gobj, topic_name)
1316
1331
  gobj,
1317
1332
  treedb_name,
1318
1333
  topic_name,
1319
- {
1320
- list_dict: true
1321
- }
1334
+ Object.assign({}, TABLE_READ_OPTIONS)
1322
1335
  );
1323
1336
  }
1324
1337
 
@@ -2371,7 +2384,7 @@ function ac_request_page(gobj, event, kw, src)
2371
2384
  gobj,
2372
2385
  gobj_read_str_attr(gobj, "treedb_name"),
2373
2386
  topic_name,
2374
- {list_dict: true},
2387
+ Object.assign({}, TABLE_READ_OPTIONS),
2375
2388
  {from: kw.from, limit: kw.limit, req_id: kw.req_id}
2376
2389
  );
2377
2390
 
@@ -2592,9 +2605,7 @@ function ac_refresh_topic(gobj, event, kw, src)
2592
2605
  return 0;
2593
2606
  }
2594
2607
 
2595
- let options = {
2596
- list_dict: true
2597
- };
2608
+ let options = Object.assign({}, TABLE_READ_OPTIONS);
2598
2609
 
2599
2610
  let treedb_name = gobj_read_str_attr(gobj, "treedb_name");
2600
2611