Repository navigation
fix(frontend): keep a newer run on screen when a decision reload lands - #41
Merged
Merged
Conversation
decideAndRefresh re-reads the run that was displayed when the overseer clicked approve/reject. If a new run was submitted while that reload was in flight, the late response replaced the new run on screen; once the new run's polling had finished, the old run stayed there. The reload is now applied with a functional update that only replaces the run still on screen (same run_id). Two regression tests hold the reload open with a deferred promise, submit a run meanwhile (still loading / already shown), and check the newer run is kept.
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.
Summary
Fixes the stale-run reload race noted in #40. After an overseer approves or rejects,
decideAndRefreshreloads the run that was on screen when they clicked. If a new run is submitted while that reload is in flight, the late response used to replace the new run on screen. Once the new run's polling had finished, the old run stayed there.Change
frontend/app/decision.js: the reloaded run is applied with a functional state update, and only if the same run (samerun_id) is still on screen. A newer run, whether still loading or already shown, is kept.frontend/test/decision.test.js: two regression tests hold the reload open with a deferred promise. Meanwhile they submit a run, both still loading and already shown, then let the reload finish and check the newer run stays. The fake page'ssetRunnow accepts updater functions, as React's does. No new dependencies.Verification
Run locally on
32f2178:npm test: 15/15 passed, including both regression testsnpm run build: passedgit diff --check: cleanStatic trace: with the old direct
setRun(reloaded), both new tests fail, because the approvedrun-1replaces the newer run. The existing approve/reject tests still reload the displayed run.