fix(tui): prevent screen flicker in policy creation flow#730
Merged
jesseturner21 merged 1 commit intomainfrom Mar 30, 2026
Merged
fix(tui): prevent screen flicker in policy creation flow#730jesseturner21 merged 1 commit intomainfrom
jesseturner21 merged 1 commit intomainfrom
Conversation
handleSelectEngine and handleAddPolicyToNewEngine perform async gateway lookups without transitioning to a loading state first, leaving the select screen interactive during the await. This causes a visible flicker when the promise resolves and the flow jumps to the policy wizard. Set flow to loading before the async calls so the UI shows a clean loading indicator during the transition.
Contributor
Package TarballHow to installnpm install https://github.com/aws/agentcore-cli/releases/download/pr-730-tarball/aws-agentcore-0.4.0.tgz |
Contributor
Coverage Report
|
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.
Description
Fixes a UI flicker in the policy creation flow where, after selecting a policy engine, the gateway selection step briefly shows "No items available" before the actual gateways appear.
Root cause:
handleSelectEngineandhandleAddPolicyToNewEngineperform async gateway lookups (getDeployedEngineId+getDeployedGateways) without transitioning to a loading state first. This leaves the select screen interactive during the await, which can cause the handler to fire multiple times (race condition). When both resolve, the flow state is set twice in quick succession, remountingAddPolicyScreen— causing the gateway list to briefly render as empty before being populated.Fix: Set the flow state to
loadingbefore the async calls. This replaces the interactive select screen with a loading indicator, preventing duplicate firings and ensuring a clean single transition to the policy wizard with gateway data already resolved.Also updated the loading message from "Loading policy engines..." to the generic "Loading..." since it is now reused for both initial load and engine-to-policy transitions.
Related Issue
Closes #
Documentation PR
N/A — no user-facing docs changes needed.
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsAdditionally, manually tested the policy creation flow end-to-end by running the CLI, selecting an engine, choosing the Generate source method, and verifying that the gateway selection step renders cleanly without briefly showing "No items available" before the gateways appear.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.