You need to review a small Vue component for a sidebar panel with a summary for the selected project. After the last PR, the panel sometimes shows numbers that do not match the current display mode, and when reopened repeatedly it starts behaving more sluggishly in the browser.
Context and contract:
projectId: string, initialMode: "compact" | "full", and open: boolean.loadProjectMetrics(projectId) returns Promise<{ total: number; completed: number; alerts: number }>.open = true, the component immediately loads metrics for the current projectId.compact/full mode.compact mode, the summary should include only completed and alerts.full mode, the summary should include total, completed, and alerts.close event.What QA observes:
Reproduction assumptions:
open=true, projectId="alpha", initialMode="compact".open between true/false several times, then press Escape once.Below is a diff from the PR. It intentionally contains bugs for the review task.
Vue 3.5.13 Composition API, TypeScript 5.8.2, Vite 5.4.x, browser, ESM. No additional libraries. The component is intended to be used in a normal Vue application with <script setup lang="ts">. The loading API in metricsApi.ts is the only data source.
Use line comments to explain the problem, its impact, the fix and how to test it.