feat(apps): poll deployments so the page follows the lifecycle - #72
Merged
Conversation
Closes #71. A deployment moves through payment → deploying → running without the customer touching anything, and both surfaces rendered whatever the API said when the page loaded. Paying a subscription in another tab left "Needs payment" on screen until a manual reload. A 5s `setInterval`, cleared on unmount, on each surface — the same shape as the two that already exist for VMs (`vm.tsx:108-110`, `account.tsx:32`): - `account-app-deployment.tsx` refetches the deployment. Not the catalog app alongside it, which does not change while the page is open. - `account-apps.tsx` refetches the deployment list. Not `listApps()`, same reason. Both feed `deploymentLifecycle()`, so the banner, the pill and the section gates re-derive together — polling the raw `status` would put back exactly what web#69/#70 removed. **Poll failures are dropped, and that is deliberate in two places.** This runs every five seconds against a page someone is reading: one dropped request should not paint an error over data that is still on screen, and the next tick recovers. On the list it also must not fall back to `[]` the way the initial load does — an empty list reads as "you have no apps", which is a worse lie than a slightly stale row. The initial load still surfaces its own failure on both pages. Known and accepted: a poll landing between a Stop/Start click and the operator's write-back can briefly show the old state, so the button appears to flip back before settling. Inherent to polling and self-correcting within one tick; the VM page has behaved this way since it shipped. Verified in headless Chrome against a stub that can flip a fixture mid-session: /account/apps/deployments/3 DEPLOYING → RUNNING within 7s, same document /account/apps row 1 NEEDS PAYMENT → RUNNING within 7s, same document navigate away to / 0 deployment requests in the next 7s The "same document" checks read a marker set on `window` before the flip, so a reload would fail them rather than pass for the wrong reason. On `0b56b69` both labels stay stale, which is the bug. `bunx tsc --noEmit` clean, `bun run build` exit 0, `prettier --check` passes on both files. No new strings. Signed-off-by: Kieran <kieran@harkin.me>
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.
Closes #71.
A deployment moves through payment → deploying → running without the customer touching anything, and both surfaces rendered whatever the API said when the page loaded. Paying a subscription in another tab left Needs payment on screen until a manual reload.
A 5s
setInterval, cleared on unmount, on each surface — the same shape as the two that already exist for VMs (vm.tsx:108-110,account.tsx:32):account-app-deployment.tsxrefetches the deployment. Not the catalog app alongside it, which does not change while the page is open.account-apps.tsxrefetches the deployment list. NotlistApps(), same reason.Both feed
deploymentLifecycle(), so the banner, the pill and the section gates re-derive together — polling the rawstatuswould put back exactly what #69/#70 removed.Poll failures are dropped, deliberately, in two places. This runs every five seconds against a page someone is reading: one dropped request should not paint an error over data that is still on screen, and the next tick recovers. On the list it also must not fall back to
[]the way the initial load does — an empty list reads as "you have no apps", a worse lie than a slightly stale row. The initial load still surfaces its own failure on both pages.Known and accepted: a poll landing between a Stop/Start click and the operator's write-back can briefly show the old state, so the button appears to flip back before settling. Inherent to polling, self-corrects within one tick; the VM page has behaved this way since it shipped.
Checks
Verified in headless Chrome against a stub that can flip a fixture mid-session:
The "same document" checks read a marker set on
windowbefore the flip, so a reload would fail them rather than pass for the wrong reason. On0b56b69both labels stay stale, which is the bug.bunx tsc --noEmitclean andbun run buildexit 0, both re-run at92c2b99.prettier --checkpasses on both files. No new strings, so no locale work. Commit unsigned (--no-gpg-sign): no pinentry TTY here.Originating channel:
lnvps(f5894ea9-44c7-56fb-bd9b-6e3e671e4bc1).