Flags SDK 4.0.6

4.0.6
Changed 2
  • Improve performance by caching next/headers imports to avoid unnecessary event loop iterations in Next.js App Router
  • Reduce microtask queue overhead in flag evaluation by replacing async IIFE around decide() with direct call and Promise.resolve()
Patch Changes
  • c08f3e5: Improve performance by caching next/headers imports.

    Previously every flag evaluation in Next.js App Router would run await import("next/headers"). The imported module is cached by the runtime, but we would still go through the event loop unnecessarily.

    Now we cache the resolved module in a local variable so only the first call awaits the dynamic import; subsequent calls skip the microtask entirely.

  • c08f3e5: Reduce microtask queue overhead in flag evaluation by replacing the async IIFE around decide() with a direct call and Promise.resolve().

View original

Upgraded? How did it go?

Discussion