Skip to content

[@vercel/flags-core] Add custom waitUntil option - #497

Open
feugy wants to merge 7 commits into
mainfrom
damienfeugas/exp-3435-custom-waituntil
Open

feugy wants to merge 7 commits into
mainfrom
damienfeugas/exp-3435-custom-waituntil

Conversation

@feugy

@feugy feugy commented Sep 10, 2026

Copy link
Copy Markdown
Member

🖖 What's in there?

Allows createClient callers to provide a custom waitUntil function for background usage and experiment exposure reporting. The default export continues to use @vercel/functions; the Next.js conditional export now defaults to after from next/server. An explicit option always wins.

Evaluation stays non-blocking. On long-lived or self-hosted processes, client.shutdown() drains pending exposure reports during graceful shutdown.

Fixes EXP-3435.

🤺 How to test?

  1. Run pnpm test in packages/vercel-flags-core.
  2. Run pnpm type-check in packages/vercel-flags-core.
  3. Run pnpm build in packages/vercel-flags-core.
  4. Verify the Next.js conditional export supplies after as the default lifecycle function.
  5. Create a client with a custom waitUntil and verify it overrides the entry-point default for usage and exposure reporting.
  6. Verify evaluation resolves while exposure reporting is pending, then verify client.shutdown() waits for that reporting to finish.

🔬 Notes to reviewers

The public type is (promise: Promise<unknown>) => void, matching @vercel/functions and common worker runtime APIs.

This provides non-blocking reporting with lifecycle registration, plus deterministic draining during graceful shutdown. It cannot guarantee delivery after abrupt process termination or permanent network failure; that requires durable storage.

🔗 Related PRs

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
flags-playground Ready Ready Preview, v0 Sep 15, 2026 1:00pm UTC
flags-sdk-dev Ready Ready Preview, v0 Sep 15, 2026 1:00pm UTC
flags-sdk-snippets Ready Ready Preview, v0 Sep 15, 2026 1:00pm UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Sep 15, 2026 1:00pm UTC
shirt-shop Ready Ready Preview, v0 Sep 15, 2026 1:00pm UTC
shirt-shop-api Ready Ready Preview, v0 Sep 15, 2026 1:00pm UTC

@feugy
feugy requested a review from dferber90 September 11, 2026 06:49
@feugy
feugy force-pushed the damienfeugas/exp-3435-custom-waituntil branch from bef5ec7 to da74a8e Compare September 11, 2026 06:53
@feugy
feugy force-pushed the damienfeugas/exp-3435-custom-waituntil branch from da74a8e to 6e38425 Compare September 11, 2026 15:10
@feugy
feugy force-pushed the damienfeugas/exp-3435-custom-waituntil branch from 6e38425 to 690efd3 Compare September 11, 2026 15:31
Comment thread apps/docs/content/docs/providers/meta.json Outdated
Comment thread skills/flags-sdk/references/providers.md Outdated
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.

3 participants