Skip to content

[BUG] Faults dashboard flashes its loading skeleton on every refresh of an empty fault list #99

Description

@bburda

Bug report

The faults dashboard replaces itself with its first-load skeleton every time the fault list is refreshed while that list is empty. The page blinks: the header, the filters and the empty-state card disappear and come back on every refresh.

The cause is in fetchFaults. It decides "this is the initial load" from faults.length === 0, so an empty list looks the same as a list that was never loaded. Every later fetch sets isLoadingFaults again, and FaultsDashboard renders DashboardSkeleton while that flag is set and the list is empty.

A second problem shows up in the same place. FaultsDashboard and FaultsCountBadge each run their own 5 second timer and their own initial fetch, so the gateway gets two GET /faults for every refresh when both are on screen.

Steps to reproduce

  1. Connect to a gateway that reports no faults.
  2. Open the Faults Dashboard and let it load.
  3. Watch the page for 15 seconds, or switch to another browser tab and come back.
  4. Open the network tab and count the requests to /faults.

Expected behavior

A refresh of an already loaded list leaves the page as it is. The skeleton belongs to the first load only. One refresh costs one request, no matter how many fault views are mounted.

Actual behavior

The whole dashboard is swapped for the skeleton and back on every refresh: every 5 seconds when the SSE fault stream is not delivering updates, and on every tab refocus even when it is. With the dashboard open and the sidebar badge visible, each refresh sends two requests instead of one.

Environment

  • ros2_medkit_web_ui version: 0.6.0
  • Browser: Chromium
  • OS: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions