feat(kanban): expose queued persistence state
req: accessibility/004\nreq: client_local/013\nreq: performance/003
This commit is contained in:
@@ -168,6 +168,8 @@ async function project(root, wasmHandler, command) {
|
||||
function report(root, stage, error) {
|
||||
const code = error && typeof error.name === "string" ? error.name : "Error";
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
root.setAttribute("data-kanban-command-phase", "failed");
|
||||
root.removeAttribute("aria-busy");
|
||||
root.setAttribute("data-kanban-command-error", `${stage}: ${message}`);
|
||||
root.setAttribute("data-kanban-command-error-stage", stage);
|
||||
root.setAttribute("data-kanban-command-error-code", code);
|
||||
@@ -266,6 +268,11 @@ async function start() {
|
||||
await clientReady(root);
|
||||
let wasmHandler;
|
||||
const durableHandler = async (...wire) => {
|
||||
const queuedCard = String(wire[2] || "1");
|
||||
root.setAttribute("data-kanban-command-phase", "queued");
|
||||
root.setAttribute("aria-busy", "true");
|
||||
announce(root, `Queued card ${queuedCard}; saving for offline use.`);
|
||||
root.dispatchEvent(new CustomEvent("kanban:command-queued", { detail: { cardId: queuedCard } }));
|
||||
let command;
|
||||
let count;
|
||||
try {
|
||||
@@ -274,6 +281,8 @@ async function start() {
|
||||
report(root, "persist", error);
|
||||
throw error;
|
||||
}
|
||||
root.setAttribute("data-kanban-command-phase", "durable");
|
||||
root.removeAttribute("aria-busy");
|
||||
root.setAttribute("data-kanban-command-count", String(count));
|
||||
root.dispatchEvent(new CustomEvent("kanban:command-persisted", {
|
||||
detail: {
|
||||
|
||||
Reference in New Issue
Block a user