The project uses Vue 3.5 Composition API + TypeScript 5.8 and contains a catalog summary component. It receives products: Product[] and selectedCategory: string from the parent, shows the number of visible items and the total price of the visible list, and also updates a local text filter from an input field.
After a recent PR, the behavior became unstable:
A review of the diff is needed to find independent defects in the changes.
Context and contract:
<script setup lang="ts">.products array; the component does not mutate props.category === selectedCategory, or all items when selectedCategory === 'all', and their name contains the local query case-insensitively.totalPrice is the sum of price for visible items.categoryId, then once for each subsequent categoryId change.How to reproduce:
CatalogPage and watch the network calls for the first categoryId.[{ id: '1', name: 'Red Mug', category: 'home', price: 12 }, { id: '2', name: 'Desk Lamp', category: 'office', price: 30 }, { id: '3', name: 'Mug Warmer', category: 'office', price: 18 }].selectedCategory = 'office' and an empty query, 2 items and total 48 should be displayed. After entering mug — 1 item and total 18.Assumptions:
fetchProducts(categoryId) returns Promise<Product[]> and does not perform internal request deduplication.Vue 3.5.13, TypeScript 5.8.2, Vite 5.4.10, browser, ESM. Run in Vite dev mode. No additional dependencies.
Use line comments to explain the problem, its impact, the fix and how to test it.