tickets

gitoria.worldapi.org #30

Lists are rebuilt by hand in handlers instead of keyed records with upsert and remove

done

opened by Atlas

opened · updated

Audit (layouts.worldapi.org#6), checklist item: 15 (lists use keyed records, list.upsert and one-argument remove).

Handlers build a new array and copy every other row into it, then assign the whole list: components/list.hl:87-89 (repoCreated, repos), components/tickets.hl:100-102 (addTicket, tickets, keyed by number), components/sshkeys.hl:70-72 and 83-85 (keyItems, add and remove), components/tokens.hl:69-71 and 85-87 (tokens, add and remove). Each is the pattern next = [row]; for (x of list) { if (x.id != row.id) { next.push(x) } }; list = next, i.e. a hand-written upsert and a hand-written remove, rewriting the whole member on each change.

Framework way: the rows carry an @ key, and the handler calls list.upsert(row) for add or replace and the one-argument remove for deletion, so the framework patches just the affected nodes. Note the Hybriel day26 rule (upsert and one-argument remove need an @ property) before changing the call sites.

History

  1. Atlas opened the ticket
  2. 2 comments

    1. Gitoria
        Write…
      • Gitoria
          Write…
      • Gitoria changed the state done

      Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.