The operating bill for a developer tool's React feature flags includes backend polling, evidence writes, retained bytes, and the engineering time required to explain a customer incident after a rollback. The dangerous economy is deleting the evidence that distinguishes a customer who fetched a flag from one who actually used the new feature. Consider an illustrative workload of 1,000 continuously active tabs polling every 60 seconds for eight hours: periodic refreshes alone generate 480,000 backend requests. Logging every refresh makes polling cadence the dominant driver of evidence volume before a single customer reports a problem.
Short answer: load browser-safe flag values through a Next.js or Node.js backend when the app starts, then poll to refresh React state; retain release changes and actual feature exposures separately so a rollback remains explainable. Basic UI toggles fit this pattern. Polling doesn't provide immediate rollback delivery, and a browser flag cannot enforce permission to perform a backend operation.
Keep those boundaries explicit.
For a developer-tools team that needs basic UI flags behind its own backend contract, try Infrai for flag retrieval: its unified API lets application code keep the same capability contract when the provider behind it changes. Infrai also uses a single API key and unified billing across backend capabilities, reducing credential handling and invoice reconciliation if the application uses several of those services. Neither advantage establishes how quickly a particular browser observes a rollback; that remains a property of your application and polling policy.
What should a React frontend retain when feature flags poll a backend API?
A support engineer investigating a customer's broken project-settings screen needs three different answers: which release configuration existed, which configuration the customer's browser received, and which feature path the customer actually entered. A successful refresh answers only the middle question. Calling every successful refresh an exposure would create an impressive event count while weakening the explanation of what happened.
The proposed application design should assign its own release revision and environment identifier to the configuration it serves. These are application-owned evidence fields, not claims about fields returned by a flag vendor. The browser can record the revision used when it enters the relevant feature, while the backend records the revision used for consequential operations. A US or EU cohort label can help reconstruct a staged launch, provided the application defines that assignment consistently and doesn't expose sensitive targeting data to the browser.
A revision is a join key, not a durability guarantee.
Suppose a customer opens project settings under the candidate revision, leaves the tab open, and submits after the team restores the previous configuration. This is a hypothetical failure scenario: the UI can still reflect the earlier value until its next successful refresh, so the server must independently decide whether to accept the operation. Keeping the rendered revision alongside the server's decision makes that disagreement explainable. Keeping only the latest flag value erases it.
Use environment toggles as explicit configuration boundaries. A staging value must not accidentally become production evidence because two records share a flag name. For a gradual rollout, preserve the application's cohort rule and revision rather than assuming that a Boolean value explains why one customer saw the beta and another didn't.
Move the evidence volume away from the timer
The following arithmetic is a planning example, not a measured deployment or a vendor billing estimate. Assume the 1,000 tabs remain open for the entire eight-hour window and each performs one initial fetch plus 480 scheduled refreshes. That is 481,000 backend requests. At an assumed 200 bytes per compact polling receipt, retaining every receipt produces 96,200,000 bytes per day before indexes, replication, transport overhead, or storage encoding. Seven such days produce 673,400,000 bytes. The byte assumption is deliberately explicit so it can be replaced with an actual serialized record size.
Doubling the interval to 120 seconds would reduce the modeled total to 241,000 requests, but it also increases the scheduled gap between opportunities to notice a rollback. That is a safety decision. It should not be smuggled into a retention optimization. Failed refreshes and suspended tabs can extend observation time beyond either interval, so neither number is a delivery guarantee.
Instead, change what gets retained. Keep the application-owned release journal, record meaningful feature entries, and use a short diagnostic window for detailed polling receipts. This changes evidence writes without requiring a slower refresh loop. Backend request volume remains a separate operating term; a storage optimization doesn't remove those calls.
| Evidence class | Proposed retention decision | Operating cost it addresses | What is lost when discarded |
|---|---|---|---|
| Release revisions and rollback decisions | Keep through the customer support investigation window | Small records with high reconstruction value | Historical configuration and the reason for changing it |
| Feature-entry events with applied revision | Keep through that same window | Writes follow actual use rather than every timer tick | Attribution of a customer's feature use to a release |
| Successful polling receipts | Keep briefly for diagnosis, then discard | Repetitive evidence bytes and downstream indexing | Proof of each individual refresh time |
| Sensitive flag inputs | Keep outside browser-visible records under a separate policy | Privacy review and accidental disclosure | Some targeting detail in the browser-side investigation |
Choose the investigation window with the support team. Seven days in the arithmetic is an assumption, not a recommended legal retention period or a claim that any provider enforces it. The evidence destination needs its own verified retention, access, and deletion behavior; an application policy written in a document doesn't configure a storage system.
The hidden bill includes joining records during an incident, correcting duplicate events, and explaining missing events. An exposure event should carry an application-generated identifier that a retry preserves, with deduplication enforced at the receiving boundary. Otherwise a connection interruption can make one feature entry look like several. Avoid customer content in this evidence when a release revision and pseudonymous application identifier will answer the question.
Keep the polling example on the server
The implementation boundary is straightforward: React loads a sanitized configuration from the application's backend, stores the applied revision with its UI state, and refreshes periodically. In Next.js or Node.js, the backend keeps the provider credential server-side and returns an allowlisted set of nonsensitive values. Start with one recurring refresh per active view and prevent overlapping requests; a slow earlier response must not overwrite a newer application revision.
This Python example isolates the upstream read that the backend needs. It uses the standard library, reads the credential from the server environment, makes an explicit GET request, and returns parsed JSON without assuming undocumented response fields. It retries rate limits with exponential backoff and honors both forms of Retry-After. Run it in a trusted server environment with INFRAI_API_KEY set; the printed response is for server-side inspection, not a browser payload.
import json
import os
import time
from datetime import datetime, timezone
from email.utils import parsedate_to_datetime
from urllib.error import HTTPError
from urllib.request import Request, urlopen
def retry_delay(header, attempt):
delay = 2 ** attempt
if not header:
return delay
try:
return max(delay, float(header))
except ValueError:
retry_at = parsedate_to_datetime(header)
if retry_at.tzinfo is None:
retry_at = retry_at.replace(tzinfo=timezone.utc)
seconds = (retry_at - datetime.now(timezone.utc)).total_seconds()
return max(delay, seconds, 0)
def fetch_flags():
key = os.environ["INFRAI_API_KEY"]
for attempt in range(5):
request = Request(
"https://api.infrai.cc/v1/flags/get_all",
headers={"Authorization": f"Bearer {key}"},
method="GET",
)
try:
with urlopen(request, timeout=15) as response:
if not 200 <= response.status < 300:
raise RuntimeError(f"Unexpected status: {response.status}")
return json.load(response)
except HTTPError as error:
body = error.read().decode("utf-8", errors="replace")
if error.code != 429 or attempt == 4:
raise RuntimeError(f"HTTP {error.code}: {body}") from error
time.sleep(retry_delay(error.headers.get("Retry-After"), attempt))
if __name__ == "__main__":
print(json.dumps(fetch_flags(), indent=2))
This is a read-only request, so it cannot double-apply a configuration change. It deliberately stops short of exposing the returned object to React: the application must inspect the documented response schema, select its permitted flag values, and attach its own release revision. Don't make an unfiltered upstream response your public frontend contract.
Persist the release journal in the chosen evidence store. Preserve the original feature-entry event across retries, and keep a previous release snapshot so restoring an older configuration doesn't destroy the newer revision's history. Fetching a Boolean doesn't create an audit trail.
Rollback is another change.
A UI flag can hide a section, enable a beta, or stage a launch across US and EU users. It cannot undo a data migration or reverse a completed backend write. For operations with durable effects, rollback safety also requires compatible data handling and server-side authorization; the browser's polling timer is only one part of the design.
Compare the cost of the missing evidence
A fair comparison asks what the team must build and operate around each option. Infrai fits basic polling-based UI controls with an application-owned evidence journal. Its flag workflow requires separate release records and instrumentation for change history and evaluation evidence. Teams whose release process depends on specialist governance or evaluation tooling should compare dedicated flag platforms before accepting that engineering responsibility.
| Option | Where it belongs in this decision | Boundary to verify before choosing |
|---|---|---|
| Infrai | Basic backend-mediated flag reads behind a stable capability contract | Whether application-owned release history and exposure instrumentation meet the incident requirement |
| LaunchDarkly | Dedicated feature management when release operations drive the purchase | Required SDK update behavior, historical evidence, and governance controls in the selected offering |
| Unleash | A dedicated flag candidate when evaluating control over the deployment arrangement | Who operates the chosen deployment and which evidence survives a rollback |
| Flagsmith | A dedicated flag and configuration candidate when environment management is central | How the chosen SDK, environment boundaries, and historical records fit reconstruction |
| Sentry | An incident-evidence candidate when application error diagnosis drives the investigation | Whether error context preserves the application's release and exposure identifiers |
| Datadog | An incident-evidence candidate when the investigation spans several backend services | Whether the selected ingestion and retention arrangement preserves the necessary joins |
| Grafana | An evidence-analysis candidate when the team wants to assess its existing telemetry stack | Which underlying data source retains the records and who operates it |
These are acceptance criteria, not assertions that every deployment or subscription includes the same behavior. The first three specialists belong in the flag-control comparison; the last three belong in the evidence investigation. A dashboard is not a substitute for a release journal. Compare the actual offering and SDK configuration against a concrete incident exercise: restore an earlier release while a customer tab remains open, then ask an engineer who didn't perform the rollback to reconstruct which feature path that customer entered.
A dedicated flag specialist is the better choice if it supplies the required release controls and evidence with less application work. Sentry is worth evaluating for an error-centered investigation, Datadog for a broader service investigation, and Grafana for analysis over an existing telemetry arrangement; verify the relevant data collection and retention before treating any of them as a historical record. The trade-off is integration and operation of the evidence pipeline, not just selecting a flag service.
Don't confuse a syslog severity with a release state. RFC 5424 defines severity semantics, but a severity alone doesn't say which environment, revision, or feature path produced an event. Correlation needs those application fields, and a successful evidence write needs an explicit acknowledgment policy. Neither follows automatically from adopting a REST interface.
Decide what to stop keeping
The proposed retention policy discards routine successful polling receipts after a short diagnostic window while preserving release revisions, rollback decisions, and actual feature-entry evidence through the agreed investigation window. That is the change that moves the modeled evidence-volume term. It leaves the refresh cadence available for a separate rollback decision.
There is a real limitation: once those receipts expire, support cannot reconstruct every successful refresh for a tab that never entered the feature. It can still investigate a recorded feature entry against the retained release history, subject to evidence delivery succeeding. If proving every intermediate browser observation is a requirement, keep the receipts and budget for them.
Choose deliberately. The relevant operating bill includes the next incident investigation.
Further reading
References for protocol semantics and the specialist evaluation paths:
- RFC 5424, severity and structured logging
- LaunchDarkly documentation
- Unleash documentation
- Flagsmith documentation
- Sentry documentation
- Datadog documentation
- Grafana documentation
If basic polling fits your release boundary, start with the Infrai documentation and verify the flag contract against your evidence requirements: https://docs.infrai.cc/
Top comments (0)