feat: refresh Human Gates review sessions (Closes #1433)
This commit is contained in:
1 parent
7dc32138e4
commit
2e9d108c6f
17 files changed
+275
-35
No files matched your search
+14
-1
@@ -13,6 +13,7 @@ function createHumanGates(options = {}) {
|
||||
let loadEpoch = 0;
|
||||
const decisionKeys = new Map();
|
||||
let decisionFlight = null;
|
||||
let openFlight = null;
|
||||
let onChange = options.onChange;
|
||||
|
||||
const escape = value => String(value ?? '').replace(/[&<>"']/g, character => ({
|
||||
@@ -203,7 +204,19 @@ function createHumanGates(options = {}) {
|
||||
function open() {
|
||||
location.hash = '#/my-work/human-gates';
|
||||
if (nodes.panel) nodes.panel.hidden = false;
|
||||
return load().then(() => reviewNext());
|
||||
if (openFlight) return openFlight;
|
||||
const operation = (async () => {
|
||||
await load();
|
||||
reviewSnapshot = queue.items.slice();
|
||||
reviewIndex = 0;
|
||||
return reviewNext();
|
||||
})();
|
||||
openFlight = operation;
|
||||
const clearFlight = () => {
|
||||
if (openFlight === operation) openFlight = null;
|
||||
};
|
||||
operation.then(clearFlight, clearFlight);
|
||||
return operation;
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -60,10 +60,7 @@ function createProgressiveHumanGates(options = {}) {
|
||||
|
||||
async function start(force = false) {
|
||||
if (!force && location.hash !== '#/my-work/human-gates') return false;
|
||||
if (started) {
|
||||
if (nodes.panel) nodes.panel.hidden = false;
|
||||
return true;
|
||||
}
|
||||
if (started) return controller.open().then(() => true);
|
||||
if (startFlight) return startFlight;
|
||||
startFlight = (async () => {
|
||||
const identity = await getIdentity();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const BASE = new URL('./', self.location.href).pathname;
|
||||
importScripts(BASE + 'static/private-data-registry.js');
|
||||
importScripts(BASE + 'static/background-issue-sync.js');
|
||||
const CACHE = 'stackchain-dashboard-shell-v144';
|
||||
const CACHE = 'stackchain-dashboard-shell-v145';
|
||||
const OFFLINE_LEASE_URL = new URL(BASE + '__offline-session-lease', self.location.origin).href;
|
||||
const OUTAGE_STATUSES = new Set([500, 502, 503, 504]);
|
||||
const NAVIGATION_TIMEOUT_MS = self.__STACKCHAIN_NAVIGATION_TIMEOUT_MS || 4000;
|
||||
|
||||
Reference in new issue
Block a user