docs(datasources): explain what a subscription costs an app - #294
Merged
Conversation
Deploying fliplet-cli with
|
| Latest commit: |
4429e69
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6313bec7.fliplet-cli.pages.dev |
| Branch Preview URL: | https://docs-subscribe-polling-cost.fliplet-cli.pages.dev |
farhantariq12b
force-pushed
the
docs/subscribe-polling-cost
branch
from
August 25, 2026 09:38
8da8519 to
815cbf5
Compare
The Data Sources page presented subscribe() as "Real-time Data Subscriptions" that "listen to real-time updates". Updates are not instant, and nothing on the page said what keeping a subscription open does to an app. That matters beyond wording: the V3 AI builder fetches this exact file for data source guidance (fliplet-studio src/v3/ai/tools/fetchFlipletDoc.js), so the framing reaches generated apps as well as developers reading it. In PS-2154 one live app subscribed to a data source that had been empty for weeks, kept checking in backgrounded tabs overnight, and carried a second timer of its own on top — all patterns the old page invited, since it never mentioned cost, showed pause()/resume() only as toys, and demonstrated cleanup as setTimeout(unsubscribe, 30000). Rewrites the section around what the reader needs to decide: - How updates arrive: within about 30 seconds, not instantly, so design around the delay. - What it costs: scales with the number of people on the screen rather than the amount of data, costs the same on an empty data source, and carries on while the app is in the background. - Two rules to follow on any screen that stays open: pause while hidden, and never add a timer of your own on top. Also replaces the setTimeout(unsubscribe, 30000) cleanup demo with a real teardown, and renames setupRealTimeUpdates to subscribeToUpdates in the pagination walkthrough so the second example stops repeating the old framing. llms-full.txt is regenerated so the published bundle carries the new text. Co-Authored-By: Claude <noreply@anthropic.com>
farhantariq12b
force-pushed
the
docs/subscribe-polling-cost
branch
from
August 25, 2026 11:05
815cbf5 to
4429e69
Compare
galisufyan-327
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JIRA Issue
https://weboo.atlassian.net/browse/PS-2154
Why
The Data Sources page presented
subscribe()as "Real-time Data Subscriptions" that "listen to real-time updates on data source changes". Updates are not instant, and nothing on the page said what keeping a subscription open actually does to an app.That matters beyond wording, because the V3 AI builder fetches this exact file for data source guidance:
So the framing reaches generated apps as well as the developers reading it. In PS-2154, one live app subscribed to a data source that had been empty for weeks, kept checking in backgrounded tabs overnight, and carried a second timer of its own on top as a "backup". Every one of those is a pattern the old page invited: it never mentioned cost, showed
pause()/resume()only as toys, and demonstrated cleanup assetTimeout(unsubscribe, 30000).What changed
The section is rewritten around what a reader has to decide, not around how the SDK works internally.
How updates arrive — within about 30 seconds rather than the instant they happen, so design around the delay. If something has to appear the moment it is created, a subscription is the wrong tool.
What a subscription costs your app
Two rules for any screen that stays open
visibilitychangeexample with thestatus()guards, and why cleaning up on teardown is not enough on its own.Also: replaced the
setTimeout(unsubscribe, 30000)cleanup demo with a real teardown, and renamedsetupRealTimeUpdates→subscribeToUpdatesin the pagination walkthrough (and its caller) so the second example stops repeating the old framing.Deliberately not included
The mechanism. An earlier draft of this led with "not a push channel", "no socket", "polled every 30 seconds" — accurate, but it reads as an internal note. Customers read this page too, and what they need is the effect on their app and what to do about it. The 30-second figure stays because it changes how you design a screen; the plumbing behind it does not.
The page also does not document a configurable interval. A change making it settable is written but has not shipped, and documenting an option that does not exist yet is worse than saying nothing.
Files Changed
docs/API/fliplet-datasources.md— the section rewritedocs/.well-known/llms-full.txt— regenerated so the published bundle carries the new textTesting
Both CI checks run clean locally, from
docs/:npm run check:docs(build-agent-indexes.mjs --strict) — exit 0npm run test:unit— 163 passing, 0 failingVerified
llms-full.txtcontains the new section and no longer contains the old wording. Without regenerating it the page would be correct while the published bundle served the old text — the driftcb6d473("regenerate llms-full.txt from source (review fix)") already caught once.llms-v3-libraries.jsonis deliberately left out: the build rewrites itsgeneratedAton every run and nothing here affects its content.Spelling checked against the repo's American English convention (
docs/CLAUDE.md).Risk
🤖 Generated with Claude Code