Files
meshcore-analyzer/tests
efiten ca74bc12f9 fix(repeater-info): keep an open edit form on screen through a re-render (#2437)
## What

On the full node page, an open repeater-info edit form now stays on
screen when the page re-renders (`theme-refresh`). Before, the fresh
section stayed empty until `GET /api/repeaters/<pk>/info` answered.

## Why

`loadFullNode` (`public/nodes.js`) replaces the page body and calls
`CSRepeaterInfo.mount` on a fresh element. `mount` kept the typed values
in its `drafts` map, but only showed the form again after the GET, so
for one round trip the form was gone.

That made `tests/e2e/test-user-management-e2e.js` flaky. Every page load
fires one `theme-refresh` about 300 ms after `/api/config/theme`
resolves. On CI that refresh sometimes landed between filling the form
and the `page.evaluate` that marks the notes field, which then threw
`Cannot read properties of null (reading 'dataset')`. The three later
repeater-info steps failed as a consequence.

Since 2026-11-10 this happened in 2 of about 150 CI runs: run
44506140120 (#2435) and run 44187421862 (a docs-only branch).

Reproduced locally with `/info` delayed 600 ms and a `theme-refresh`
after filling the form: the notes field was missing during the refresh
on the old code, and present on this branch (3 of 3 runs).

## Changes

`public/repeater-info.js`:
- `mount` shows an open draft at once, in the same task as the
re-render. The GET only replaces it when the user lost edit rights.
- Cancel before the GET answers no longer throws on a null `info`; the
section stays hidden until the view can render.
- A failed GET leaves an open form in place.
- A save on the early form is not overwritten by the older GET answer.
- A section the page already replaced ignores its late GET, so it cannot
delete the draft its successor owns.

`tests/e2e/test-user-management-e2e.js:745`: the side-pane step
collapsed whitespace with `/s+/`; now `/\s+/`.

## Tests

- `tests/unit/test-repeater-info.js`: 6 new cases, 27 pass. All 6 fail
on the old `repeater-info.js`.
- `tests/e2e/test-user-management-e2e.js`: 44/44 locally against an
`e2etest` build, run twice.
- `test-all.sh`: green locally, except the three suites that also fail
on master on Windows (`test-manage-workflow.js`,
`test-preflight-xss-gate.js`, `test-dev-static.js`).

## Not done

- The side pane (`#node-repeater-info-pane`) still has a short gap. On
`theme-refresh`, `selectNode` shows "Loading…" before `fetchNodeDetail`
and only then mounts. The draft comes back, but the form is off screen
during that fetch. Fixing it means changing the pane render path in
`nodes.js`, which is outside this PR.
- Focus and caret are still lost when the form is rebuilt. That was
already the case before this PR.
2026-11-19 18:33:14 +01:00
..