Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/specs/grid-selection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ async function cellAt(toplevel, position, cell) {
/** The number cell selects and never opens an editor, which is why every gesture below lands on it. */
/** How many times the grid has been committed, which `CueList.tsx` counts on the element. */
function gridRenders() {
return browser.execute(() => Number(document.documentElement.dataset.gridRenders) || 0);
return browser.execute(() => Number(window.__gridRenders) || 0);
}

/** Wait until the grid stops drawing on its own, so the count below is about the click. */
Expand Down
7 changes: 5 additions & 2 deletions src/components/CueList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ export default function CueList({
// Every commit of the grid, counted where a check can read it. Interface-spec 7.2 asks a click on
// the row the cursor already holds to change nothing, and a render that happened for nothing is
// invisible from outside by definition. No dependency list: this counts commits, not values.
//
// On a property and not on the element: the grid commits with the playhead, and an attribute
// written on `<html>` that often can cost the whole document a style recalculation. See N175.
useEffect(() => {
const root = document.documentElement;
root.dataset.gridRenders = String((Number(root.dataset.gridRenders) || 0) + 1);
const counted = window as unknown as { __gridRenders?: number };
counted.__gridRenders = (counted.__gridRenders ?? 0) + 1;
});
const [scrollTop, setScrollTop] = useState(0);
const [viewport, setViewport] = useState(0);
Expand Down
Loading