Skip to content

fix(work-tracker): check res.ok on delete ops before toasting success#72

Open
Chzhqv wants to merge 1 commit into
TemaDeveloper:mainfrom
Chzhqv:fix/work-tracker-delete-error-handling
Open

fix(work-tracker): check res.ok on delete ops before toasting success#72
Chzhqv wants to merge 1 commit into
TemaDeveloper:mainfrom
Chzhqv:fix/work-tracker-delete-error-handling

Conversation

@Chzhqv

@Chzhqv Chzhqv commented Jul 7, 2026

Copy link
Copy Markdown

Summary

  • Three deletes in work-tracker.tsx (session, expense, route) fired the DELETE request then unconditionally toasted success and called router.refresh(), with no res.ok check and no .catch.
  • A failed delete still showed "deleted", and a rejected fetch was an unhandled promise rejection.
  • All three now check res.ok (error toast + no refresh on failure) and catch rejected fetches.

Test plan

  • Added a regression suite (work-tracker/__tests__/work-tracker-delete.test.tsx) covering all 3 delete handlers across fail/success/network-reject paths (9 cases) — confirmed it fails without the fix (6/9 fail with unhandled rejections) and passes with it (9/9)
  • pnpm lint, tsc --noEmit, full vitest run (565/565) all pass

Fixes #21

Three deletes (session, expense, route) fired the DELETE request then
unconditionally toasted success and refreshed, with no res.ok check
and no .catch. A failed delete still showed "deleted", and a rejected
fetch was an unhandled promise rejection.

Added a regression test suite covering all three delete handlers
across fail/success/reject paths (confirmed it fails without the fix,
passes with it).

Fixes TemaDeveloper#21
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Artemii's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

bug: work-tracker delete ops don't check res.ok before updating UI

1 participant