swarm-ui: one hook for a read that runs once per set of inputs
Part of the unification order in the UI sweep issue (step d, first of three). Twenty files hand-rolled the same effect: a cancelled flag, a fetch, the problem body on a bad status, a catch that wraps the error. useResource does it once on top of the poller's request discipline: it aborts the request in flight when the inputs change or the page goes away, keeps the last good answer under a failed read and clears the error on the next good one. The agent details move to it (limits, linked accounts, ssh CA, permission catalogue, allowed and denied domains). Hint drops its HintTone alias for the shared Tone.
This commit is contained in:
parent
6f73bf0c55
commit
7f8d6abc58
1 changed files with 279 additions and 134 deletions
|
|
@ -9,6 +9,7 @@ import {
|
|||
behindNote,
|
||||
entriesFor,
|
||||
entryBody,
|
||||
shownError,
|
||||
} from "../src/agent/detail/allowed-domains.ts";
|
||||
|
||||
const all = [
|
||||
|
|
@ -114,3 +115,10 @@ test("the deny list names the hives that have not applied it, and says nothing w
|
|||
/^pr1ma, mu3de have not applied this list yet/,
|
||||
);
|
||||
});
|
||||
|
||||
test("a failed removal shows before a failed read, and a read shows alone", () => {
|
||||
assert.equal(shownError("remove", "read"), "remove");
|
||||
assert.equal(shownError(null, "read"), "read");
|
||||
assert.equal(shownError("remove", null), "remove");
|
||||
assert.equal(shownError(null, null), null);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue