All Docs
FeaturesDepositClearUpdated March 6, 2026

How we cut dashboard load time by 75% with one Promise.all

How we cut dashboard load time by 75% with one Promise.all

Released in v0.1.0

The problem

Every time a user opened their dashboard, the server was making four separate database calls to build the stats panel:

  1. Organisation member count
  2. Feedback item count
  3. Activity log entry count
  4. Subscription status

Those four calls were written as sequential await statements, so each one had to finish before the next could start:

// Before — 4 sequential awaits, 4 full network round-trips
const [members]       = await db.select(...).from(orgMembers)...;
const [feedbackCount] = await db.select(...).from(feedback)...;
const [activityCount] = await db.select(...).from(auditLog)...;
const [sub]           = await db.select(...).from(subscriptions)...;

DepositClear uses Neon's HTTP driver, where each query incurs a full network round-trip of roughly 20 ms. With four sequential queries that added up to ~80 ms of pure waiting — before any rendering had started.

The fix

Because none of the four queries depend on each other's results, they can all be fired at the same time and awaited together with Promise.all:

// After — all four in parallel, 1 network round-trip
const [[members], [feedbackCount], [activityCount], [sub]] = await Promise.all([
  db.select(...).from(orgMembers)...,
  db.select(...).from(feedback)...,
  db.select(...).from(auditLog)...,
  db.select(...).from(subscriptions)...,
]);

The total wait time is now determined by the slowest single query rather than the sum of all four.

Result

BeforeAfter
Network round-trips4 × ~20 ms1 × ~20 ms
Typical latency~80 ms~20 ms
Reduction75%

The return shape of the dashboard.stats procedure is identical — no changes to any callers were needed.

What else landed in v0.1.0

Alongside the performance fix, v0.1.0 also ships the CI pipeline that was previously missing from the repository. A .github/workflows/ci.yml workflow now runs on every PR and every push to main, verifying that the project builds and tests pass on Node 20 before code is merged. See the Changelog for full details.