Skip to content

Refresh routines list after context-menu Run now - #441

Merged
TheGreatAxios merged 2 commits into
mainfrom
cl-7137-right-click-run-now-on-a-routine-leaves-the-routines-list
Aug 29, 2026
Merged

TheGreatAxios merged 2 commits into
mainfrom
cl-7137-right-click-run-now-on-a-routine-leaves-the-routines-list

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Fixes CL-7137 — https://linear.app/abklabs/issue/CL-7137

Problem

The routine panel's Run now button (apps/web/src/shell/routine-panel.tsx:611) invalidates the routines list and run history after a successful run. The shell context menu's Run now item (apps/web/src/shell/context-menu/items.tsx:149-159) calls the same runRoutineNow but only toasts — ShellContextMenuActions (items.tsx:40-45) had no way to trigger a refetch, so the routines list and run history stayed stale after a right-click Run now.

Change

  • Added invalidateRoutineQueries(queryClient, tenantId) next to tenantKeys in apps/web/src/query-client.ts, shared by both call sites.
  • routine-panel.tsx's Run now button now calls the shared helper instead of duplicating the two invalidateQueries calls.
  • Added onRoutineRan(tenantId) to ShellContextMenuActions; the context menu's run-now item calls it after a successful run.
  • shell-context-menu.tsx wires onRoutineRan to invalidateRoutineQueries via useQueryClient().

Tests

apps/web/src/shell/context-menu/items.test.tsx: run-now success calls onRoutineRan with the tenant id; run-now failure does not call it.

Ran locally: bun test src/shell/context-menu/items.test.tsx test/routine-panel.test.tsx test/query-client.test.ts src/query-client.test.ts (all pass), bun run typecheck (clean), prettier + eslint on changed files (clean). The 1-minute load average on this shared machine was above 40 when finishing, so the full bun run check was skipped locally per the builder brief — CI is the gate for that.

Covers the run-now success case (onRoutineRan called with the tenant
id) and failure case (not called) so the fix below has a red/green
pair to prove against.
Right-clicking a routine and choosing Run now only toasted — the
routines list and run history stayed stale until an unrelated refetch,
unlike the routine panel's own Run now button. Thread onRoutineRan
through ShellContextMenuActions and reuse the panel's exact
invalidation via a shared invalidateRoutineQueries helper.

Fixes CL-7137.
@TheGreatAxios
TheGreatAxios force-pushed the cl-7137-right-click-run-now-on-a-routine-leaves-the-routines-list branch from d2c03a2 to 588d686 Compare August 29, 2026 04:46
@TheGreatAxios
TheGreatAxios merged commit 775c5db into main Aug 29, 2026
5 checks passed
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.

1 participant