fix(ui): prevent concurrent environment mutations - #7751
Conversation
|
💬 Discussion in Slack: #pr-review-infisical-7751-fix-ui-prevent-concurrent-environment-mutations Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a876bcaeb
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
| }} | ||
| isDisabled={!isAllowed} | ||
| isDisabled={!isAllowed || deleteWsEnvironment.isPending} |
There was a problem hiding this comment.
Disable Create during reorder and restore mutations
When a reorder or restore request is slow, this button remains enabled because it observes only deleteWsEnvironment.isPending, while those other pending states are local to EnvironmentTable. A user can therefore start creating an environment before the first mutation finishes, so the environment mutation serialization added by this change remains incomplete; lift the table mutation state or otherwise share a single pending guard with this button.
Useful? React with 👍 / 👎.
|
| Filename | Overview |
|---|---|
| frontend/src/components/permissions/ProjectPermissionCan.tsx | Migrates permission tooltips from the v2 wrapper to the equivalent v3 Tooltip composition without an established contract regression. |
| frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentSection.tsx | Adds shared delete pending-state guards and feedback, but the soft-delete AlertDialogAction still closes before the pending guard can observe the mutation. |
| frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/EnvironmentTable.tsx | Serializes table reorder and restore actions, displays initiating-action feedback, and migrates legacy color utilities to semantic tokens. |
| frontend/src/pages/secret-manager/SettingsPage/components/EnvironmentSection/UpdateEnvironmentModal.tsx | Adds a minimum-length constraint that rejects an empty environment name while preserving the documented whitespace behavior. |
Reviews (1): Last reviewed commit: "Prevent concurrent environment mutations..." | Re-trigger Greptile
| if (!isOpen && deleteWsEnvironment.isPending) return; | ||
| handlePopUpToggle("deleteEnv", isOpen); |
There was a problem hiding this comment.
Pending deletion dialog closes early
When a user confirms scheduled deletion, AlertDialogAction requests closure in the same activation that starts the mutation, so this guard still sees the previous isPending value and allows the dialog to close. The newly added pending feedback is therefore hidden while the deletion request is running, and the dialog does not remain locked as intended.
Context
PLATFOR-679 completes the remaining parity work for the project Settings Environments surface.
Before this change, reorder, restore, soft-delete, and hard-delete actions could be submitted repeatedly or concurrently without consistent pending feedback. Edit validation also allowed an empty environment name. The Environments surface also retained legacy color utilities, and its permission wrapper depended on the v2 Tooltip component.
This change:
frontend/src/index.css.Linear: PLATFOR-679
Screenshots
Not captured in this environment. Outstanding draft-PR evidence:
Steps to verify the change
cd frontend && npm run lint.cd frontend && npm run type:check.Type
Checklist
fix(ui): prevent concurrent environment mutations