import { createSignal, For, untrack } from 'solid-js' import { render } from 'solid-js/web' import { CELLS, count, glyph, harness } from '../shared/harness.js' const ran = (v: T) => (count.runs++, v) const [n, setN] = createSignal(0) const cells = Array.from({ length: CELLS }, () => createSignal(0)) function Counter() { count.renders++ return ( ) } function Cell(props: { i: number }) { count.renders++ return {ran(glyph(cells[props.i][0]()))} } function Grid() { count.renders++ return (
{(_, i) => { const index = untrack(i) return }}
) } const tick = (k: number) => { for (let i = k % 10; i < CELLS; i += 10) cells[i][1]((v) => v + 1) } const root = document.getElementById('root')! render( () => (
), root, ) harness(root, { click: () => setN((v) => v + 1), tick, runs: () => count.runs })