@yuneta/gobj-ui 7.25.4 → 7.25.6

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
@@ -790,6 +790,49 @@ writes in flight when the transport closes are answered refused on the
790
790
  transport edge (`form_writes_in_flight.js`), so the form comes back on what
791
791
  was typed instead of staying busy for ever.
792
792
 
793
+ **Where the transport edge comes from** (7.25.5). Until 7.25.4 only from the
794
+ host, as `EV_TRANSPORT_STATE` — and two hosts (wattyzer, yunovatios) never
795
+ forwarded it, so a websocket drop during a Save left Save and Cancel busy for
796
+ ever. The view now also hears it from its SHELL: `yui_shell_set_connection_state()`
797
+ — which every single-backend app already calls for the toolbar dot — publishes
798
+ `EV_CONNECTION_STATE {connected}` on each edge, and `C_YUI_TREEDB_TOPICS`
799
+ subscribes to it in `mt_start`. Nothing to add in such a host. A host with
800
+ one transport per view (gui_treedb's `C_TREEDB_VIEW`, gui_agent's
801
+ `C_AGENT_TREEDB_VIEW`) keeps forwarding `EV_TRANSPORT_STATE`; both paths can
802
+ fire for one edge, and the view answers each write once. The view never
803
+ subscribes to the transport itself: a subscription to a `C_IEVENT_CLI` is
804
+ forwarded to the backend.
805
+
806
+ `EV_CONNECTION_STATE` reaches only the subscribers that DECLARE it: an app
807
+ that subscribed to every event of its shell with the `subscriber` attr does
808
+ not get it (the shell's `mt_publication_pre_filter`), so adding it broke no
809
+ app.
810
+
811
+ ```js
812
+ // The app, from its transport handlers -- as it already did for the dot:
813
+ yui_shell_set_connection_state(shell, false); // EV_ON_CLOSE
814
+ // -> every C_YUI_TREEDB_TOPICS under that shell answers its forms'
815
+ // writes in flight EV_WRITE_REFUSED, and they come back on what was typed.
816
+ ```
817
+
818
+ A write is known by its topic AND its serial (`<topic>^<form_write>`): each
819
+ topic's form counts its serials from 1, and keyed by the serial alone two
820
+ forms saving at once shared one entry.
821
+
822
+ **The pkey2 of an update goes back as the record had it** (7.25.5). It names
823
+ the instance the write is for, and a `time` pkey2 that crossed the form's
824
+ `datetime-local` came back without its seconds — another instance, or none.
825
+ `instance_keys_of()` (`treedb_write_plan.js`) keeps it from the record the
826
+ form was opened on.
827
+
828
+ **Known limit — the change of hour** (`form_time_value.js`). A
829
+ `datetime-local` holds a local wall time and no offset. The night the clocks
830
+ go back, one hour happens twice: an epoch in its second pass is shown with the
831
+ wall time of the first and read back one hour earlier, so saving that record —
832
+ any field of it — moves a WRITABLE time column holding it by -3600 s. The
833
+ hour skipped in spring holds no epoch, so nothing read there comes back wrong.
834
+ Read-only time columns never go back, and a time pkey2 goes back as it was.
835
+
793
836
  ```js
794
837
  // A host of C_YUI_TREEDB_TOPIC_WITH_FORM that answers the form's writes
795
838
  gobj_create_pure_child(name, "C_YUI_TREEDB_TOPIC_WITH_FORM",
@@ -802,7 +845,24 @@ gobj_send_event(topic_form, ok ? "EV_WRITE_DONE" : "EV_WRITE_REFUSED",
802
845
  **A delete is resolved by IDENTITY, never by position** (7.23.193). The row's
803
846
  `id` crosses the confirmation dialog; a Tabulator position is regenerated by
804
847
  every row the node events add or remove while the dialog is open, and it used
805
- to delete the row that sat there when the person answered.
848
+ to delete the row that sat there when the person answered. Rows (table) or
849
+ cards (`C_G6_NODES_TREE`) that another writer deleted while the question was
850
+ open are not deleted and the person is told (7.25.4); the rest go on.
851
+
852
+ Consumer i18n keys of the form's writes and deletes — define them in the app,
853
+ or they render as the key itself in every language:
854
+
855
+ | key | shown when |
856
+ |---|---|
857
+ | `no session` | a Save asked with no backend session: the write is not sent (7.25.2) |
858
+ | `some records were gone before the delete` | a confirmed delete named rows or cards that no longer exist (7.25.4). The text must not promise a refresh: nothing is reloaded, and in the graph there is no table |
859
+
860
+ ```js
861
+ // en.js / es.js of the app
862
+ "no session": "No session",
863
+ "some records were gone before the delete":
864
+ "Some records no longer existed when the delete was confirmed; they were not deleted",
865
+ ```
806
866
 
807
867
  ### Reading a topic table: filters, columns, CSV
808
868
 
@@ -2030,6 +2090,17 @@ host sends it as `EV_DRAFTS`; `drafts_of_saved_answer()` reads the unnamed
2030
2090
  answer into the shape the event takes. What the session wrote stays marked;
2031
2091
  what the host said is applied again after every reload of the model.
2032
2092
 
2093
+ **`EV_DRAFTS` REPLACES what the host said before** (7.25.5). It only added,
2094
+ and a topic the host had named before a Save stayed a draft after the Save
2095
+ that published it ("unsaved schema changes" again). The editor keeps the
2096
+ host's marks apart from its session's writes (`host_draft_ids()`) and swaps
2097
+ them whole on each `EV_DRAFTS`, so a host sends the COMPLETE set every time —
2098
+ an empty `{drafts: {}}` included, which is how "nothing is a draft any more"
2099
+ is said. What `draft_changed` measures is the node's: the draft against the
2100
+ SAVED schema on a node newer than yunetas 7.25.3, against the file in use on
2101
+ a 7.25.3 node (where a topic saved and not yet applied is still a draft until
2102
+ the Apply).
2103
+
2033
2104
  ```js
2034
2105
  // The host, when its saved-schema answers land (rows = the unnamed answer's data)
2035
2106
  import {drafts_of_saved_answer} from "@yuneta/gobj-ui/src/host_drafts.js";
@@ -2083,6 +2154,20 @@ else.
2083
2154
  - In: `EV_SHOW` (`{subpath}` — the tail it owns is `<treedb>[/<topic>]` or
2084
2155
  `<treedb>/diagram`), `EV_HIDE`, `EV_TRANSPORT_STATE`, `EV_REFRESH`,
2085
2156
  `EV_LANGUAGE_CHANGED`, `EV_MT_COMMAND_ANSWER`.
2157
+ - A **drop** of the transport — `EV_TRANSPORT_STATE {connected: false}`, or a
2158
+ failed answer that arrives while the transport is out of `ST_SESSION` — ends
2159
+ the load or the write it cut, and the model is asked again on the next
2160
+ `{connected: true}`. A write cut this way is shown as
2161
+ `the connection dropped during the write` (an i18n key the consumer's
2162
+ locales carry). Each request carries its round in `__md_command__`
2163
+ (`round` / `write`), so an answer of what the drop cut is ignored with a
2164
+ warning.
2165
+
2166
+ ```js
2167
+ // the host forwards its session edges; nothing else is needed
2168
+ gobj_send_event(editor, "EV_TRANSPORT_STATE", {connected: false}, host);
2169
+ gobj_send_event(editor, "EV_TRANSPORT_STATE", {connected: true}, host);
2170
+ ```
2086
2171
  - Out: `EV_POSITION_CHANGED` (`{subpath}` — the host writes the url; this view
2087
2172
  navigates nothing itself), `EV_RECORD_WRITTEN` (whoever owns the Apply needs
2088
2173
  to know the yuno has not re-read its schema yet), `EV_SCHEMA_CHECKED`