Files
DemonGatanjieuandClaude Opus 5.5 54facc44c1 Record the 1.63 standard exam and fix two things it found
Gemini 3.8 Flash took all 8 standard questions the 1.63 way (the
question in the task's message, the new task page's sentence to the
AI, a blank canvas each): 128 calls, 16% failed (21% last time), no
detours. Written into docs/architecture/tool-exam.md.

- A task's picture count counted a picture twice when the AI's report
  showed the one its run had made; pictures are counted once each now.
- After a switch of language the AI workbench kept rows drawn in the
  old one until a reload: syncRows makes a row again when the language
  it was drawn in is not the one shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 19:18:06 +08:00

29 lines
1.2 KiB
JavaScript

/**
* Drawing a list again without drawing it all (the AI workbench's timeline and task list): each row
* has a key that changes when what it shows changes, and only rows with a new key are made.
*/
import { resolveLocale } from './locales.js';
/**
* Puts `rows` ({key, make()}) into `parent` in this order: a child already there with the same
* key, drawn in the language shown now, is kept as it is (moved only when the rows before it
* changed), the others are made, and the children no row asks for go.
*/
export function syncRows(parent, rows) {
const language = resolveLocale(); // after a switch of language every row is made again
const kept = new Map([...parent.children].map(child => [child.dataset.rowKey, child]));
rows.forEach((row, at) => {
let node = kept.get(row.key);
if (node?.dataset.rowLanguage === language) {
kept.delete(row.key);
} else {
node = row.make();
node.dataset.rowKey = row.key;
node.dataset.rowLanguage = language;
}
if (parent.children[at] !== node) parent.insertBefore(node, parent.children[at] || null);
});
for (const node of kept.values()) node.remove();
}