Skip to content

[prepare-flags-definitions] Embed the time the config changed as fetchedAt - #657

Draft
javivelasco wants to merge 1 commit into
mainfrom
javi/stable-bundled-fetched-at
Draft

javivelasco wants to merge 1 commit into
mainfrom
javi/stable-bundled-fetched-at

Conversation

@javivelasco

@javivelasco javivelasco commented Nov 28, 2026 •

Copy link
Copy Markdown
Member
  • The bundled definitions embed fetchedAt: Date.now(), so the generated @vercel/flags-definitions module differs in every build even when the flags did not change. On Vercel that chunk ships inside server functions, and it was the only file that differed between two builds of a function in one of our projects, which prevents the function from being reused.
  • fetchedAt is now the config's configUpdatedAt. The bundle still never looks fresher than it is, because the data is at least that old.
  • When the response has no valid configUpdatedAt, or it is in the future, the time of the fetch is used as before.

Validation

  • This changes behaviour that an existing test asserted on purpose (the build time being embedded), so it needs a decision from the flags team.
  • My reading of vercel-flags-core: by the time a function runs, the bundle is already older than the freshness windows, so it is treated as old either way, and the build uses the bundle regardless of age. The difference is a function that starts within that window after the build fetched the data, which now does one extra refresh. I have not exercised that against a running client.

@vercel

vercel Bot commented Nov 28, 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 Nov 28, 2026 10:01am UTC
flags-sdk-dev Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-flagsmith Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-growthbook Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-launchdarkly Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-openfeature Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-posthog Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-reflag Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-snippets Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-statsig Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
flags-sdk-sveltekit-snippets Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
shirt-shop Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC
shirt-shop-api Ready Ready Preview, v0 Nov 28, 2026 10:01am UTC

This branch was successfully deployed

14 active deployments
Preview – flags-sdk-sveltekit-snippets — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-dev — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-statsig — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-snippets — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-posthog — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – shirt-shop — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-reflag — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-launchdarkly — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-vercel — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-growthbook — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-openfeature — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – shirt-shop-api — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-playground — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
Preview – flags-sdk-flagsmith — 51e2a41a Deployed Nov 28, 2026 by vercel[bot]
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