inspector/clients/web/src/components
Repository files (latest commit first)
Filename Latest commit message Latest commit date
cliffhall 05bbfe5074 fix: read the completions map by own property, not through the prototype
Addresses Copilot's round-17 review on #2035. A real crash, and a class the
earlier prototype work missed rather than a narrower version of it.

`toString`, `constructor` and `__proto__` are valid RFC 6570 variable names,
and `completions` starts as `{}`. So for such a name:

  completions["toString"] ?? []   =>  the prototype's FUNCTION

`??` catches only null and undefined, so that function went to Mantine's
Autocomplete as its `data`, and the field crashed on first render with
`TypeError: data.map is not a function` -- reproduced by reverting the fix
under the new test.

The earlier rounds fixed this for the *values* map, which is seeded with
every declared variable and so always has the key as an own property. The
completions map is the one name-keyed map this component reads WITHOUT
having seeded it, which is what made it the surviving instance. Both reads
now go through `Object.hasOwn` -- the render, and the stale-dropdown check
that clears a variable's options on the next keystroke.

Only the autocomplete branch could reach it, so the regression drives that
branch: completions supported, a `{toString}` template, type and submit.

npm run ci passes.

Signed-off-by: cliffhall <cliff@futurescale.com>
2026-08-17 01:25:58 -04:00
..
elements chore(lint): enable no-floating-promises in all five ESLint scopes 2026-08-16 20:57:32 -04:00
groups fix: read the completions map by own property, not through the prototype 2026-08-17 01:25:58 -04:00
screens chore(lint): enable no-floating-promises in all five ESLint scopes 2026-08-16 20:57:32 -04:00
views/InspectorView chore(lint): enable no-floating-promises in all five ESLint scopes 2026-08-16 20:57:32 -04:00