fix_pages_crawled_counter.md•2.06 kB
# BUG: "Pages Crawled" Counter Shows 0 Incorrectly
**Issue:** The "Pages Crawled" counter in the "Data" statistics section (likely rendered by `components/JobStatsSummary.tsx`) displays 0, even when multiple URLs in the Crawl Queue have reached the 'completed' status.
**Observed Behavior:** (See user-provided images)
* Crawl Queue shows URLs with status 'completed'.
* "Data" tab shows "Pages Crawled: 0".
**Expected Behavior:** The "Pages Crawled" counter should accurately reflect the number of URLs within the current `jobStatus.urls` object that have `status: 'completed'`.
**Affected Components:**
* `components/JobStatsSummary.tsx` (Likely responsible for calculating/displaying the stat)
* `app/page.tsx` (Provides `jobStatus` prop to `JobStatsSummary`)
* `lib/types.ts` (Definition of `CrawlJobStatus` and `UrlStatus`)
**Potential Causes:**
* Logic within `JobStatsSummary.tsx` incorrectly calculates the count of completed pages from the `jobStatus.urls` object.
* The `jobStatus` prop being passed from `app/page.tsx` to `JobStatsSummary.tsx` might be stale or incomplete at the time of rendering the count.
* Misinterpretation of the `UrlStatus` enum/type ('completed').
**Analysis (Code Mode):**
* Prop passing from `app/page.tsx` was correct.
* The calculation logic in `countUrlsByStatus` within `components/JobStatsSummary.tsx` was incorrect; it wasn't properly accessing the `status` within the `UrlDetails` object for each URL.
**Subtasks:**
1. [x] **Analyze Counter Logic:** Completed by Code Mode.
2. [x] **Analyze Prop Passing:** Completed by Code Mode.
3. [x] **Propose Fix Plan:** Modify `countUrlsByStatus` in `JobStatsSummary.tsx`.
4. [x] **Review Fix Plan (Expert Opinion Mode):** Skipped (Implemented by Code Mode).
5. [x] **Update Plan (if needed):** N/A.
6. [x] **User Approval:** Skipped (Implemented by Code Mode).
7. [x] **Implement Fix (Code Mode):** Completed by Code Mode.
8. [x] **Verify Fix:** Completed by Code Mode.
9. [x] **Seal Task List:** Marking as complete based on Code Mode result.