Summary
Navigate away from #/analytics and back with no ?tab= in the URL. The tab bar then shows Overview as active, but the content area renders the previously selected tab, for example Topology. The URL, the active tab button and the content disagree.
The cloud re-review of PR #175 round 2 found this. It is pre-existing: the same behaviour exists on #175's earlier head 1c510d48 and on master. It is not caused by #175.
Relates to #172, #175.
Where (#175 head d7cd59b2)
public/analytics.js:
_currentTab is module state, set on tab click (~240) and read when rendering (~80, ~222, ~227).
destroy() (~3148) resets _analyticsData, _channelData, timers and handlers, but not _currentTab.
- On the next mount without
?tab=, the tab bar defaults to Overview, while the render path still uses the stale _currentTab.
Fix
- Reset
_currentTab in destroy(), for example to 'overview' or null, so a new mount starts from the URL or the default.
- On mount, derive the active tab from
?tab= in the hash, falling back to Overview. Keep the tab button, the content and the URL in sync (AGENTS.md deep-link rule).
Test
A vm or E2E test:
- Mount analytics.
- Select Topology.
destroy() and mount again without ?tab=.
- Assert that the active button and the rendered content are both Overview.
Also: mount with ?tab=topology gives Topology for both the button and the content.
Mutant: remove the reset in destroy(); the test must turn red.
Do not start before #175 is merged, because it edits the same file.
Summary
Navigate away from
#/analyticsand back with no?tab=in the URL. The tab bar then shows Overview as active, but the content area renders the previously selected tab, for example Topology. The URL, the active tab button and the content disagree.The cloud re-review of PR #175 round 2 found this. It is pre-existing: the same behaviour exists on #175's earlier head
1c510d48and on master. It is not caused by #175.Relates to #172, #175.
Where (#175 head
d7cd59b2)public/analytics.js:_currentTabis module state, set on tab click (~240) and read when rendering (~80, ~222, ~227).destroy()(~3148) resets_analyticsData,_channelData, timers and handlers, but not_currentTab.?tab=, the tab bar defaults to Overview, while the render path still uses the stale_currentTab.Fix
_currentTabindestroy(), for example to'overview'ornull, so a new mount starts from the URL or the default.?tab=in the hash, falling back to Overview. Keep the tab button, the content and the URL in sync (AGENTS.md deep-link rule).Test
A vm or E2E test:
destroy()and mount again without?tab=.Also: mount with
?tab=topologygives Topology for both the button and the content.Mutant: remove the reset in
destroy(); the test must turn red.Do not start before #175 is merged, because it edits the same file.