Skip to content

Commit eddac85

Browse files
committed
fix: address second review round
- searchTimeEntries pagination termination now uses explicit undefined/NaN checks instead of truthy (`!nextId || !nextRowNumber`), so a legitimate 0 cursor value is not mistaken for end-of-results (Copilot). - Comment on `toggl_get_time_entries` post-filters said "on hydrated entries" but the implementation applies them before hydration. Update the comment to match the code (Copilot). - README: "Free-plan" -> "Free plan" (CodeRabbit).
1 parent 6aec500 commit eddac85

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ Dashboard-parity search backed by **Toggl Reports API v3**. Per-workspace, auto-
161161
}
162162
```
163163
Notes:
164-
- `billable` is a premium feature; Free-plan workspaces will surface a 402 error.
164+
- `billable` is a premium feature; Free plan workspaces will surface a 402 error.
165165
- Date range is required (either `start_date`+`end_date` or a `period`).
166166
- Pagination is automatic via `X-Next-ID` / `X-Next-Row-Number`; cap traversal with `max_pages`.
167167

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ const tools: Tool[] = [
163163
end_date: { type: 'string', description: 'End date (YYYY-MM-DD format)' },
164164
workspace_id: { type: 'number', description: 'Filter by workspace ID' },
165165
project_id: { type: 'number', description: 'Filter by project ID' },
166-
// Post-filter additions (applied after fetch, on hydrated entries).
166+
// Post-filter additions (applied client-side after fetch, before hydration).
167167
description: { type: 'string', description: 'Case-insensitive substring match on entry description' },
168168
billable: { type: 'boolean', description: 'Filter by billable status' },
169169
user_ids: { type: 'array', items: { type: 'number' }, description: 'Filter by user IDs (client-side post-filter)' },

src/toggl-api.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,14 @@ export class TogglAPI {
363363
}
364364
}
365365

366-
if (!nextId || !nextRowNumber) break;
366+
// Use explicit undefined/NaN checks so a legitimate 0 cursor value
367+
// (possible if Toggl ever uses it) is not mistaken for end-of-results.
368+
if (
369+
nextId === undefined || Number.isNaN(nextId) ||
370+
nextRowNumber === undefined || Number.isNaN(nextRowNumber)
371+
) {
372+
break;
373+
}
367374
payload.first_id = nextId;
368375
payload.first_row_number = nextRowNumber;
369376
}

0 commit comments

Comments
 (0)