Fossil SCM

Chat help text cleanups and add a FIXME regarding connection failure (as opposed to HTTP-level errors) while polling for new chat messages (which is not a new problem, but is one which came up while working on fts5-chat-search).

stephan 2024-07-02 12:04 fts5-chat-search
Commit 4711a8c4ddd2e14af03b092c59311ad21f055fb92509d4e7fedac820cf60f9e3
1 file changed +19 -3
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1881,12 +1881,13 @@
18811881
boolValue: 'edit-ctrl-send'
18821882
},{
18831883
label: "Compact mode",
18841884
hint: [
18851885
"Toggle between a space-saving or more spacious writing area. ",
1886
- "When the input field has focus, is empty, and preview mode ",
1887
- "is NOT active then Shift-Enter toggles this setting."].join(''),
1886
+ "When the input field has focus and is empty ",
1887
+ "then Shift-Enter may (depending on the current view) toggle this setting."
1888
+ ].join(''),
18881889
boolValue: 'edit-compact-mode'
18891890
},{
18901891
label: "Use 'contenteditable' editing mode",
18911892
boolValue: 'edit-widget-x',
18921893
hint: [
@@ -2127,11 +2128,11 @@
21272128
s.value ? 'add' : 'remove'
21282129
]('compact');
21292130
Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus();
21302131
});
21312132
Chat.settings.addListener('edit-ctrl-send',function(s){
2132
- const label = "Submit message ("+(s.value ? "Ctrl-" : "")+"Enter)";
2133
+ const label = (s.value ? "Ctrl-" : "")+"Enter submits message";
21332134
Chat.e.inputFields.forEach((e)=>{
21342135
const v = e.dataset.placeholder0 + " " +label;
21352136
if(e.isContentEditable) e.dataset.placeholder = v;
21362137
else D.attr(e,'placeholder',v);
21372138
});
@@ -2458,10 +2459,25 @@
24582459
delete Chat.intervalTimer;
24592460
}
24602461
poll.running = false;
24612462
};
24622463
afterFetch.isFirstCall = true;
2464
+ /**
2465
+ FIXME: when polling fails because the remote server is
2466
+ reachable but it's not accepting HTTP requests, we should back
2467
+ off on polling for a while. e.g. if the remote web server process
2468
+ is killed, the poll fails quickly and immediately retries,
2469
+ hammering the remote server until the httpd is back up. That
2470
+ happens often during development of this application.
2471
+
2472
+ XHR does not offer a direct way of distinguishing between
2473
+ HTTP/connection errors, but we can hypothetically use the
2474
+ xhrRequest.status value to do so, with status==0 being a
2475
+ connection error. We do not currently have a clean way of passing
2476
+ that info back to the fossil.fetch() client, so we'll need to
2477
+ hammer on that API a bit to get this working.
2478
+ */
24632479
const poll = async function f(){
24642480
if(f.running) return;
24652481
f.running = true;
24662482
Chat._isBatchLoading = f.isFirstCall;
24672483
if(true===f.isFirstCall){
24682484
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1881,12 +1881,13 @@
1881 boolValue: 'edit-ctrl-send'
1882 },{
1883 label: "Compact mode",
1884 hint: [
1885 "Toggle between a space-saving or more spacious writing area. ",
1886 "When the input field has focus, is empty, and preview mode ",
1887 "is NOT active then Shift-Enter toggles this setting."].join(''),
 
1888 boolValue: 'edit-compact-mode'
1889 },{
1890 label: "Use 'contenteditable' editing mode",
1891 boolValue: 'edit-widget-x',
1892 hint: [
@@ -2127,11 +2128,11 @@
2127 s.value ? 'add' : 'remove'
2128 ]('compact');
2129 Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus();
2130 });
2131 Chat.settings.addListener('edit-ctrl-send',function(s){
2132 const label = "Submit message ("+(s.value ? "Ctrl-" : "")+"Enter)";
2133 Chat.e.inputFields.forEach((e)=>{
2134 const v = e.dataset.placeholder0 + " " +label;
2135 if(e.isContentEditable) e.dataset.placeholder = v;
2136 else D.attr(e,'placeholder',v);
2137 });
@@ -2458,10 +2459,25 @@
2458 delete Chat.intervalTimer;
2459 }
2460 poll.running = false;
2461 };
2462 afterFetch.isFirstCall = true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2463 const poll = async function f(){
2464 if(f.running) return;
2465 f.running = true;
2466 Chat._isBatchLoading = f.isFirstCall;
2467 if(true===f.isFirstCall){
2468
--- src/fossil.page.chat.js
+++ src/fossil.page.chat.js
@@ -1881,12 +1881,13 @@
1881 boolValue: 'edit-ctrl-send'
1882 },{
1883 label: "Compact mode",
1884 hint: [
1885 "Toggle between a space-saving or more spacious writing area. ",
1886 "When the input field has focus and is empty ",
1887 "then Shift-Enter may (depending on the current view) toggle this setting."
1888 ].join(''),
1889 boolValue: 'edit-compact-mode'
1890 },{
1891 label: "Use 'contenteditable' editing mode",
1892 boolValue: 'edit-widget-x',
1893 hint: [
@@ -2127,11 +2128,11 @@
2128 s.value ? 'add' : 'remove'
2129 ]('compact');
2130 Chat.e.inputFields[Chat.e.inputFields.$currentIndex].focus();
2131 });
2132 Chat.settings.addListener('edit-ctrl-send',function(s){
2133 const label = (s.value ? "Ctrl-" : "")+"Enter submits message";
2134 Chat.e.inputFields.forEach((e)=>{
2135 const v = e.dataset.placeholder0 + " " +label;
2136 if(e.isContentEditable) e.dataset.placeholder = v;
2137 else D.attr(e,'placeholder',v);
2138 });
@@ -2458,10 +2459,25 @@
2459 delete Chat.intervalTimer;
2460 }
2461 poll.running = false;
2462 };
2463 afterFetch.isFirstCall = true;
2464 /**
2465 FIXME: when polling fails because the remote server is
2466 reachable but it's not accepting HTTP requests, we should back
2467 off on polling for a while. e.g. if the remote web server process
2468 is killed, the poll fails quickly and immediately retries,
2469 hammering the remote server until the httpd is back up. That
2470 happens often during development of this application.
2471
2472 XHR does not offer a direct way of distinguishing between
2473 HTTP/connection errors, but we can hypothetically use the
2474 xhrRequest.status value to do so, with status==0 being a
2475 connection error. We do not currently have a clean way of passing
2476 that info back to the fossil.fetch() client, so we'll need to
2477 hammer on that API a bit to get this working.
2478 */
2479 const poll = async function f(){
2480 if(f.running) return;
2481 f.running = true;
2482 Chat._isBatchLoading = f.isFirstCall;
2483 if(true===f.isFirstCall){
2484

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button