Repository navigation
Conversation
The EC2 lists in the Networking panel, the Compute launch form, the instance console output, the RDS form's security groups and the shared ec2.queries hooks were cached under keys without the account. Switching accounts invalidated them, but until the refetch finished (or for good, if it failed) the panel showed the previous account's VPCs, subnets and route tables, with Delete buttons that would send those ids to the new account. Every EC2 query key now ends with the active account, as the instance detail query already does. Invalidations of the shorter keys still match every account's copy by prefix. The launch form's optimistic security group insert writes to the account the group was created in.
Contributor
[Medium impact] The PR appears safe to merge.
|
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
Several EC2 views cached their data under query keys without the account:
api/aws/ec2.queries.ts.The account switcher invalidates all queries, so these refetch, but until the refetch finishes they show the previous account's data.
In Networking, after switching from
000000000000to111111111111, the panel listed account000000000000's VPC, subnet and route table while the resource table above it was loading account111111111111.If the refetch fails, the old account's data stays, and its Delete buttons send those ids to the new account.
Changes:
ComputePanelalready does.The account goes last, so existing invalidations of
['ec2', 'vpcs']and similar still match every account's copy by prefix, and a response that arrives after a switch lands under the account it was requested for.ec2.queries.tsdoes this in one smalluseAccountScopedhelper used by each hook.setQueryData, an exact key) writes to the account the group was created in, captured when the create started.Type of change
fix:)feat:)feat!:orfix!:)Area
packages/frontend)packages/api)Verification
AWS EC2 via Floci core built from
floci-io/flocimain at0eef65385, EC2 mock mode, in-memory storage.Fixtures: VPC
uifix-vpc-awith a subnet in account000000000000, VPCuifix-vpc-bin account111111111111.Checked in Chrome at 1440x1000, with API responses delayed by 4 s so the refetch window is visible: open Networking in
000000000000, switch to111111111111in Settings, return to Networking.111111111111loadsmainuifix-vpc-a,10.40.1.0/24, its route table (account000000000000)uifix-vpc-buifix-vpc-bThe Compute launch form still lists the account's AMIs, subnets and security groups.
NetworkingPanel.test.tsxadds a test that switches the account while the new account's VPCs are pending and expects the previous account's VPC to be gone; it fails onmain.Checklist
pnpm lint,pnpm type-check,pnpm test, andpnpm buildpass locally (API 2,795 pass, frontend 306 pass)bun testinpackages/api)