Skip to content

Commit 2bb35b2

Browse files
committed
fix(manage): surface activity end refresh failures
1 parent 04e2fa2 commit 2bb35b2

3 files changed

Lines changed: 82 additions & 2 deletions

File tree

apps/frontend-manage/src/components/courses/modals/GroupActivityEndingModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function GroupActivityEndingModal({
8282
await Promise.all([
8383
utils.course.detail.invalidate({ courseId }),
8484
refetchActivities?.(),
85-
]).catch(console.error)
85+
])
8686
}}
8787
submitting={endActivity.isLoading}
8888
confirmations={confirmations}

apps/frontend-manage/src/components/courses/modals/MicroLearningEndingModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function MicroLearningEndingModal({
6666
await Promise.all([
6767
utils.course.detail.invalidate({ courseId }),
6868
refetchActivities?.(),
69-
]).catch(console.error)
69+
])
7070
}}
7171
submitting={endActivity.isLoading}
7272
confirmations={{}}

project/plans_future/graphql-to-trpc-dual-api-migration/FULL_IMPLEMENTATION_PLAN.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,86 @@ rg -n "@apollo/client|ApolloProvider|@klicker-uzh/graphql|graphql-yoga|graphql-w
423423

424424
## Progress
425425

426+
### 2026-06-24 Completed Locally With Runtime Blockers: Manage Activity End Refresh UX
427+
428+
Status: complete locally with runtime blockers. Scope stayed inside the tRPC
429+
UX/client-quality audit and the already migrated frontend-manage microlearning
430+
and group-activity end workflows. No new migration slice, S05/S06 cleanup,
431+
GraphQL removal, Apollo removal, or package cleanup was started.
432+
433+
Context:
434+
435+
- Branch state before this patch: local `codex/trpc-dual-api-migration` was
436+
clean and aligned with origin at `04e2fa276`.
437+
- PR #5132 head is `04e2fa276e288bbb783e9a50a647deb4ad255a77`, ready for
438+
review, not draft, with review approval still required.
439+
- Current-head checks for `04e2fa276` had restarted after the activity
440+
extension refresh UX push. GitGuardian and CodeQL java-kotlin/python were
441+
green; Cypress wrapper run `28074297141` had started for the current head;
442+
`packages/graphql Vitest`, `packages/api tRPC Vitest`, typecheck, lint,
443+
format, SonarCloud, OLAT API tests, util tests, and staged Docker builds
444+
were still running or queued when this local slice was verified.
445+
- Context7 docs were refreshed before this audit work. Relevant behavior: tRPC
446+
`useUtils()` invalidation helpers wrap TanStack Query cache operations, and
447+
React Query v4 `mutateAsync` supports promise-based sequencing for required
448+
post-mutation side effects.
449+
450+
Findings:
451+
452+
- `MicroLearningEndingModal` and `GroupActivityEndingModal` already use the
453+
migrated `activity.end` tRPC mutation.
454+
- Both flows use `ActivityConfirmationModal`, which keeps the modal open,
455+
disables duplicate submit with its pending state, and shows the existing
456+
generic system-error toast when `onSubmit` rejects.
457+
- After a successful end mutation, the visible course detail and activity list
458+
depend on refreshing `course.detail` and the parent activity list before the
459+
confirmation modal closes.
460+
- Both required post-success refreshes were hidden behind `catch(console.error)`,
461+
so refresh failures could still close the modal while the visible activity
462+
state stayed stale and the user saw no failure.
463+
464+
Change:
465+
466+
- Let the `course.detail` invalidation / parent activity-list refetch reject in
467+
both end flows.
468+
- The existing `ActivityConfirmationModal` error boundary now keeps the modal
469+
open and shows the existing generic system-error toast if required refresh
470+
fails after the server-side end mutation succeeds.
471+
- Existing mutation inputs, summary loading/error fallback, confirmation
472+
checklist behavior, pending guards, query keys, and GraphQL/tRPC coexistence
473+
remain unchanged.
474+
475+
Verification:
476+
477+
- `./node_modules/.bin/prettier --config .prettierrc.mjs --write apps/frontend-manage/src/components/courses/modals/MicroLearningEndingModal.tsx apps/frontend-manage/src/components/courses/modals/GroupActivityEndingModal.tsx`:
478+
passed; files unchanged by formatter.
479+
- `./node_modules/.bin/tsc -p apps/frontend-manage/tsconfig.json --noEmit --pretty false`:
480+
passed.
481+
- `git diff --check`: passed.
482+
- `rg -n "catch\\(console\\.error\\)|endActivity|course\\.detail\\.invalidate|ActivityConfirmationModal|systemError" apps/frontend-manage/src/components/courses/modals/MicroLearningEndingModal.tsx apps/frontend-manage/src/components/courses/modals/GroupActivityEndingModal.tsx apps/frontend-manage/src/components/courses/modals/ActivityConfirmationModal.tsx`:
483+
old silent refresh catches removed from both end flows; shared confirmation
484+
modal still owns the visible generic error path.
485+
- Browser/runtime verification blocked locally:
486+
- `curl -sS -I http://127.0.0.1:3002`: connection refused.
487+
- `curl -sS -I http://127.0.0.1:3000/api/trpc`: connection refused.
488+
489+
Review / simplification:
490+
491+
- Dedicated review/simplification subagents were not used because the available
492+
multi-agent tool requires explicit user authorization for delegation in this
493+
environment.
494+
- Self-review confirmed the diff is limited to two already migrated activity
495+
end workflows plus this progress entry; it changes no tRPC inputs, no
496+
GraphQL/Apollo coexistence paths, and no broader cache policy.
497+
- Simplification check: no new helper or abstraction was added; both flows now
498+
rely on the existing `ActivityConfirmationModal` failure handling instead of
499+
duplicating local toast logic.
500+
501+
Next:
502+
503+
- Commit and push this focused manage activity-end refresh-failure UX cleanup,
504+
then refresh PR checks and Cypress/review state.
505+
426506
### 2026-06-24 Completed Locally With Runtime Blockers: Manage Activity Extension Refresh UX
427507

428508
Status: complete locally with runtime blockers. Scope stayed inside the tRPC

0 commit comments

Comments
 (0)