Skip to content

API: add a typed hook for the /health/deep endpoint - #210

Open
greatest0fallt1me wants to merge 1 commit into
QuickLendX:mainfrom
greatest0fallt1me:feat/118-usehealthdeep-refetch
Open

API: add a typed hook for the /health/deep endpoint#210
greatest0fallt1me wants to merge 1 commit into
QuickLendX:mainfrom
greatest0fallt1me:feat/118-usehealthdeep-refetch

Conversation

@greatest0fallt1me

Copy link
Copy Markdown

Note on scope

`useHealthDeep()` already existed and was already tested (fetch, typed result, success/error handling). The one real gap: no way to re-run the check after the initial mount.

Change

Added `refetch()` to `UseHealthDeepResult`, which re-triggers the fetch effect via an internal attempt counter. Loading/error state resets on each refetch.

Tests

Added a case: after an initial failed fetch, `refetch()` re-runs the request and recovers (loading toggles, second fetch call observed, health populated, error cleared).

`npx vitest run lib/hooks/useHealthDeep.test.ts`: 3 passed. `npx tsc --noEmit` / `npx eslint` on changed files: clean.

Closes #118

useHealthDeep had no way to re-run the health check after the initial
mount -- a caller that wanted to re-check after resolving a reported
issue had no option but a full page reload. Add refetch(), matching
the convention gap shared by the other data hooks in this repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API: add a typed hook for the /health/deep endpoint

1 participant