mirror of
https://github.com/Kpa-clawbot/meshcore-analyzer.git
synced 2026-06-03 09:14:22 +00:00
7fcb226cd8
## Summary Fixes #1486 — clicking the collapse chevron on a grouped packet row in the packets table no longer reopens the detail panel that the operator just closed. ## Root cause In the `#pktBody` row click handler the `toggle-select` action ran **both** `pktToggleGroup(value)` and `pktSelectHash(value)` on every chevron click. `pktToggleGroup()` already opens the detail panel itself (via `selectPacket()`) when it expands a row, so the trailing `pktSelectHash()` was: - redundant on **expand** (the panel was already opening), and - harmful on **collapse** — after the operator closed the detail panel via the ✕ in `#pktRight`, clicking the same chevron a second time to collapse the tree re-fetched `/packets/<hash>` and re-populated the panel with the same packet, exactly the behavior the issue describes. ## Fix Drop the unconditional `pktSelectHash(value)` call inside the `toggle-select` branch. `pktToggleGroup()` already handles the expand-side panel open; the collapse branch does no panel work, so a closed panel stays closed. ```js else if (action === 'toggle-select') { // #1486: pktToggleGroup() already opens the detail panel on EXPAND // (via selectPacket()), and must NOT open it on COLLAPSE. pktToggleGroup(value); } ``` ## Tests - New Playwright E2E `test-issue-1486-collapse-reopens-detail-e2e.js` walks the operator-visible repro: expand → assert panel open → click ✕ → assert panel empty → click chevron again → assert row collapsed AND panel STILL empty. - Committed red-first: the test was added in its own commit and FAILS on the unpatched code (3 passed / 1 failed), then GREEN on the fix commit (4 passed / 0 failed). - CI workflow seeds two extra observations onto the newest fixture transmission so a grouped (`toggle-select`) row exists; without this the fixture renders only flat rows and the chevron can't be exercised. ## Reproduction (manual, against staging or local) 1. Open `/#/packets` on desktop. 2. Click a grouped row's `▶` chevron — the tree expands and the detail panel opens on the right. 3. Click the `✕` in the top-right of the detail panel — panel goes back to "Select a packet to view details". 4. Click the same chevron (now `▼`) again — **before:** detail panel reopens with the same packet. **After:** the row collapses and the panel stays empty. --------- Co-authored-by: mc-bot <bot@meshcore.local>