fix: restore environment polling after #7284 regression#7313
Closed
talissoncosta wants to merge 1 commit intomainfrom
Closed
fix: restore environment polling after #7284 regression#7313talissoncosta wants to merge 1 commit intomainfrom
talissoncosta wants to merge 1 commit intomainfrom
Conversation
EnvironmentReadyChecker.tsx passed `pollingInterval: data?.is_creating ? POLL_INTERVAL_MS : 0` to useGetEnvironmentQuery, where `data` was the same hook's destructured result. At the time the options object is evaluated, `data` is unassigned, so the reference silently resolved to `undefined` and `pollingInterval` was always `0`. Envs returned with `is_creating: false` on first fetch rendered children and hid the bug; envs still in the creating state on the backend showed "Preparing your environment" indefinitely until a full page reload. Gate pollingInterval on a `pollingStopped` state flag updated by a useEffect after the hook returns. Resets on environment ID change so polling restarts for newly-visited envs. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
I have added information todocs/if required so people know about the feature.Changes
Follow-up to #7284.
Bug
Environments that come back with
is_creating: truefrom the API got stuck on the "Preparing your environment" loader indefinitely. A full page reload was the only way to recover.Root cause
EnvironmentReadyChecker.tsxpassedpollingInterval: data?.is_creating ? POLL_INTERVAL_MS : 0touseGetEnvironmentQuery, wheredatais the same hook's destructured result. At the time the options object is evaluated,datais unassigned, so the reference silently resolved toundefinedandpollingIntervalwas always0. Polling never started.For envs returning
is_creating: falseon the first fetch (the common case), the component rendered children immediately and the bug was invisible. For envs still in the creating state on the backend, polling never re-fetched, so the UI never detected the transition to ready.Fix
Gate
pollingIntervalon apollingStoppedstate flag updated by auseEffectafter the hook returns. The flag resets when the URL environment changes so polling restarts for newly-visited envs, and flips totrueonce the env is known-ready or known-bad (error / different project).How did you test this code?
Manual:
data = { ...rawData, is_creating: true }in the render path so the "Preparing your environment" loader was always displayed.environments/, navigated to an environment's Features page, and left it for ~1 minute./api/v1/environments/{key}/followed by ~100 seconds of silence — no polling./api/v1/environments/{key}/fires every ~1 second whileis_creating: true. Polling stops cleanly once the response showsis_creating: false, on error, or if the env belongs to a different project. Switching to a different environment resets the flag and restarts polling.No new unit tests: the frontend's Jest config is Node-only (no jsdom) and there is no existing React component test infrastructure. Worth following up with a dedicated component-test harness PR to guard against this class of regression in the future.
🤖 Generated with Claude Code