Skip to content

fix: campaigns page perf and loading UX#357

Merged
alanw707 merged 1 commit into
mainfrom
fix/campaigns-perf-and-loading-ux
Apr 10, 2026
Merged

fix: campaigns page perf and loading UX#357
alanw707 merged 1 commit into
mainfrom
fix/campaigns-perf-and-loading-ux

Conversation

@alanw707
Copy link
Copy Markdown
Owner

Summary

  • Backend: Rewrite segment query uploadsByUser from navigation-property Count() (correlated subquery) to explicit Join + GroupBy on ProcessedImages — single-pass aggregate instead of N subqueries (~30s → sub-second)
  • Backend: Add IX_MarketingCampaigns_CreatedAt index for campaigns list ORDER BY
  • Frontend: Remove full-page "Loading…" replacement for list view — show table shell (headers, empty state) immediately
  • Frontend: Fix broken reviews route missing loadComponent (Angular 19 Router validation)

Test plan

  • Navigate to /admin/campaigns — table headers and empty state visible immediately, no "Loading…" flash
  • New Campaign → select any segment → Count recipients resolves in < 3s
  • Verify segment counts are numerically correct
  • Detail and logs views still show "Loading…" appropriately
  • All existing backend tests pass (309/309)

🤖 Generated with Claude Code

…ndex

The previous segment query rewrite (PR #352) changed C# structure but not
the generated SQL — navigation property Count() inside Select() still
produced a correlated subquery per UserProfile row (~30s).

This rewrites uploadsByUser to use an explicit Join + GroupBy on the
ProcessedImages table, generating a single-pass GROUP BY aggregate that
uses the existing IX_ProcessedImages_UserProfileId_IsOriginalUpload index.

Frontend: remove full-page "Loading…" replacement for the list view — show
the table shell (headers, empty state) immediately so the page feels instant.

Also adds IX_MarketingCampaigns_CreatedAt for the ORDER BY in GetCampaignsAsync,
and fixes the reviews route missing loadComponent (Angular 19 validation).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alanw707 alanw707 merged commit 6ae29e3 into main Apr 10, 2026
3 checks passed
@alanw707 alanw707 deleted the fix/campaigns-perf-and-loading-ux branch April 10, 2026 13:54
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