Skip to content

fix(analytics): after leaving and returning to #/analytics, Overview is marked active but the old tab's content is shown #183

Description

@dborup

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:

  1. Mount analytics.
  2. Select Topology.
  3. destroy() and mount again without ?tab=.
  4. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions