Skip to content

Conversation

@ktx-abhay
Copy link
Collaborator

fix #8997

@github-actions github-actions bot added the ☢️ Bug Something isn't working label Dec 10, 2025
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 10, 2025

Greptile Overview

Greptile Summary

Modified cache restoration logic to skip local storage cache when dashboard is in print mode by checking the forceLoad flag.

Key Changes:

  • Added condition forceLoad?.value != true to line 1242 to prevent cache restoration in print mode
  • Ensures fresh data is fetched when printing dashboards instead of showing potentially stale cached data

Context:
The forceLoad flag is set to true when store.state.printMode is active (ViewDashboard.vue:270), signaling that panels should bypass cache and load fresh data for accurate print output.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is minimal, well-targeted, and addresses a specific bug without affecting other functionality. It adds a simple boolean check that prevents cache restoration when forceLoad is true, which is exactly what's needed for print mode. The fix is conservative and doesn't introduce new logic or modify existing behavior in normal mode.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
web/src/composables/dashboard/usePanelDataLoader.ts 5/5 Added condition to skip cache restoration when forceLoad is true (line 1242), preventing stale data display in print mode

Sequence Diagram

sequenceDiagram
    participant User
    participant ViewDashboard
    participant RenderDashboardCharts
    participant PanelDataLoader
    participant Cache
    participant API

    User->>ViewDashboard: Click Print Button
    ViewDashboard->>ViewDashboard: setPrintMode(true)
    ViewDashboard->>RenderDashboardCharts: forceLoad={printMode: true}
    RenderDashboardCharts->>PanelDataLoader: Initialize with forceLoad=true
    
    alt Print Mode (forceLoad=true)
        PanelDataLoader->>PanelDataLoader: loadData()
        PanelDataLoader->>PanelDataLoader: Check runCount == 0 && forceLoad != true
        Note over PanelDataLoader,Cache: Condition false, skip cache
        PanelDataLoader->>API: Fetch fresh data
        API-->>PanelDataLoader: Return current data
        PanelDataLoader-->>User: Display fresh dashboard
    else Normal Mode (forceLoad=false)
        PanelDataLoader->>PanelDataLoader: loadData()
        PanelDataLoader->>PanelDataLoader: Check runCount == 0 && forceLoad != true
        Note over PanelDataLoader,Cache: Condition true, use cache
        PanelDataLoader->>Cache: restoreFromCache()
        Cache-->>PanelDataLoader: Return cached data
        PanelDataLoader-->>User: Display cached dashboard
    end
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@ktx-abhay ktx-abhay merged commit fccc6a1 into branch-v0.14.6-rc9 Dec 10, 2025
12 of 18 checks passed
@ktx-abhay ktx-abhay deleted the fix/skip-local-cache-for-print-dashboard-rc9 branch December 10, 2025 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

☢️ Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants