The quiet problem with unnecessary async

2 min read

There’s a pattern in JavaScript codebases that quietly spreads complexity. You’ve probably seen something like this:

async function getConfig() {
  return defaultConfig;
}

At first glance, this barely feels like a decision.

Maybe one day getConfig() will fetch something remotely. Maybe it’ll hit IndexedDB later. Making it async now can feel harmless, even responsible.

The problem is that async changes the contract of the function.

What changes when a function becomes async

The moment a function becomes async, it stops returning a value directly and starts returning a Promise, even if there’s no await inside.

That changes every caller downstream.

const config = getConfig();

becomes:

const config = await getConfig();

And then the surrounding code adapts too. Callers have to await, tests have to await, and anything composing them starts passing Promises around.

People sometimes call this the function coloring problem:

Years ago I inherited a codebase where almost every helper returned a Promise. Tracing a request path meant following await after await before eventually discovering where the actual asynchronous work was happening. Most of those functions were just returning data that was already in memory.

What made it frustrating wasn’t the syntax itself. It was the uncertainty. Every function looked equally “asynchronous” from the outside, so the signatures stopped telling me where the real I/O lived.

That’s when I started paying more attention to where async boundaries actually belong.

“We might need it later”

A common justification looks like this:

async function getFeatureFlags() {
  return localFlags;
}

And the reasoning is usually:

Sometimes that’s a good reason.

Public libraries often expose async APIs early because changing them later can be painful. Consistency across implementations matters, too.

Application code tends to be different. Internal helpers often become async speculatively even when nothing asynchronous is happening yet.

Right now there’s no suspension point and no I/O, but every consumer still pays the async cost today.

async communicates meaning

When I’m skimming code I’m unfamiliar with, I use function signatures as shortcuts.

If I see this:

async function loadUser()

I assume there’s a real boundary there somewhere, like network activity, storage access, or background processing. Something that can’t be produced immediately.

That’s useful information. When a function returns data that’s already available, marking it async implies work that isn’t happening.

The mental overhead

Performance usually isn’t the issue here. Modern JavaScript engines handle Promises well. The cost is mostly cognitive.

Compare:

function getTheme() {
  return currentTheme;
}

with:

async function getTheme() {
  return currentTheme;
}

Now compare the call sites:

const theme = getTheme();
applyTheme(theme);

vs.:

const theme = await getTheme();
applyTheme(theme);

One stays inside synchronous control flow. The other introduces async flow, even though the underlying data is already available.

Tests often make this especially noticeable. One unnecessary Promise can turn a simple test file into a chain of async setup and assertions.

Async boundaries matter

Modern front-end systems are already heavily async:

  • Streaming SSR
  • React Server Components
  • Edge runtimes
  • Server actions
  • Async routing
  • Suspense-driven rendering

Async boundaries affect rendering, composition, error handling, and debugging, so I try to treat them as architectural decisions, not implementation details.

A rough rule I follow: async should represent real async boundaries, not hypothetical future requirements. If a function doesn’t await anything, it’s worth asking why it’s async in the first place.

Keep APIs honest

Instead of designing around what a function might someday become, design around what it is today.

If it’s synchronous:

function getConfig() {
  return defaultConfig;
}

keep it synchronous.

If real asynchronous work arrives later, introduce async deliberately. Until then, smaller async boundaries are easier to trace and keep signatures meaningful.

Once a function is async, everything that calls it feels it.