Fossil SCM
Internal commentary on the validity of the global UI enable/disable approach to XHR handling.
Commit
7a95a0f178fdc1c49bd499b716849360f687334b706092ec9936bca3f8290750
Parent
7e197260fd1a797…
1 file changed
+23
-1
+23
-1
| --- src/fossil.page.fileedit.js | ||
| +++ src/fossil.page.fileedit.js | ||
| @@ -564,11 +564,33 @@ | ||
| 564 | 564 | /** |
| 565 | 565 | Keep track of how many in-flight AJAX requests there are so we |
| 566 | 566 | can disable input elements while any are pending. For |
| 567 | 567 | simplicity's sake we simply disable ALL OF IT while any AJAX is |
| 568 | 568 | pending, rather than disabling operation-specific UI elements, |
| 569 | - which would be a huge maintenance hassle.. | |
| 569 | + which would be a huge maintenance hassle. | |
| 570 | + | |
| 571 | + Noting, however, that this global on/off is not *quite* | |
| 572 | + pedantically correct. Pedantically speaking. If an element is | |
| 573 | + disabled before an XHR starts, this code "should" notice that and | |
| 574 | + not include it in the to-re-enable list. That would be annoying | |
| 575 | + to do, and becomes impossible to do properly once multiple XHRs | |
| 576 | + are in transit and an element is disabled seprately between two | |
| 577 | + of those in-transit requests (that would be an unlikely, but | |
| 578 | + possible, corner case). As of this writing, the only elements | |
| 579 | + which are ever normally programmatically toggled between | |
| 580 | + enabled/disabled... | |
| 581 | + | |
| 582 | + 1) Belong to the file selection list and remain disabled until | |
| 583 | + the list of leaves and files are loaded. i.e. they would be | |
| 584 | + disabled *anyway* during their own XHR requests. | |
| 585 | + | |
| 586 | + 2) The stashWidget's SELECT list when no local edits are | |
| 587 | + stashed. Curiously, the all-or-nothing re-enabling implemented | |
| 588 | + here does not re-enable that particular selection list. That's | |
| 589 | + because of timing, though: that widget is "manually" disabled | |
| 590 | + when the list is empty, and that list is normally emptied in | |
| 591 | + conjunction with an XHR request. | |
| 570 | 592 | */ |
| 571 | 593 | const ajaxState = { |
| 572 | 594 | count: 0 /* in-flight F.fetch() requests */, |
| 573 | 595 | toDisable: undefined /* elements to disable during ajax activity */ |
| 574 | 596 | }; |
| 575 | 597 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -564,11 +564,33 @@ | |
| 564 | /** |
| 565 | Keep track of how many in-flight AJAX requests there are so we |
| 566 | can disable input elements while any are pending. For |
| 567 | simplicity's sake we simply disable ALL OF IT while any AJAX is |
| 568 | pending, rather than disabling operation-specific UI elements, |
| 569 | which would be a huge maintenance hassle.. |
| 570 | */ |
| 571 | const ajaxState = { |
| 572 | count: 0 /* in-flight F.fetch() requests */, |
| 573 | toDisable: undefined /* elements to disable during ajax activity */ |
| 574 | }; |
| 575 |
| --- src/fossil.page.fileedit.js | |
| +++ src/fossil.page.fileedit.js | |
| @@ -564,11 +564,33 @@ | |
| 564 | /** |
| 565 | Keep track of how many in-flight AJAX requests there are so we |
| 566 | can disable input elements while any are pending. For |
| 567 | simplicity's sake we simply disable ALL OF IT while any AJAX is |
| 568 | pending, rather than disabling operation-specific UI elements, |
| 569 | which would be a huge maintenance hassle. |
| 570 | |
| 571 | Noting, however, that this global on/off is not *quite* |
| 572 | pedantically correct. Pedantically speaking. If an element is |
| 573 | disabled before an XHR starts, this code "should" notice that and |
| 574 | not include it in the to-re-enable list. That would be annoying |
| 575 | to do, and becomes impossible to do properly once multiple XHRs |
| 576 | are in transit and an element is disabled seprately between two |
| 577 | of those in-transit requests (that would be an unlikely, but |
| 578 | possible, corner case). As of this writing, the only elements |
| 579 | which are ever normally programmatically toggled between |
| 580 | enabled/disabled... |
| 581 | |
| 582 | 1) Belong to the file selection list and remain disabled until |
| 583 | the list of leaves and files are loaded. i.e. they would be |
| 584 | disabled *anyway* during their own XHR requests. |
| 585 | |
| 586 | 2) The stashWidget's SELECT list when no local edits are |
| 587 | stashed. Curiously, the all-or-nothing re-enabling implemented |
| 588 | here does not re-enable that particular selection list. That's |
| 589 | because of timing, though: that widget is "manually" disabled |
| 590 | when the list is empty, and that list is normally emptied in |
| 591 | conjunction with an XHR request. |
| 592 | */ |
| 593 | const ajaxState = { |
| 594 | count: 0 /* in-flight F.fetch() requests */, |
| 595 | toDisable: undefined /* elements to disable during ajax activity */ |
| 596 | }; |
| 597 |