feat(cloud): rename custom sandbox env images#3617
Merged
Conversation
|
😎 Merged successfully - details. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
tatoalo
marked this pull request as ready for review
July 21, 2026 12:03
Contributor
Prompt To Fix All With AIFix the following 3 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 3
packages/ui/src/features/settings/sections/environments/CloudEnvironmentsSettings.tsx:480-481
**Failed Rename Rejects Unhandled**
When the PATCH fails because of a network, authentication, or backend error, `mutateAsync` rejects and both callers discard that promise with `void`. The mutation callback shows a toast but does not consume the rejection, so the application also emits an unhandled promise rejection.
```suggestion
try {
await updateImageMutation.mutateAsync({ id: renameImage.id, name });
setRenameImage(null);
} catch {
// The mutation's onError callback displays the failure.
}
```
### Issue 2 of 3
packages/ui/src/features/settings/sections/environments/CloudEnvironmentsSettings.tsx:1154-1159
**Enter Bypasses Pending Guard**
The Enter handler invokes the rename callback even while the first request is pending, unlike the loading Save button. Holding or quickly pressing Enter twice can therefore start concurrent PATCH requests and display duplicate mutation feedback.
```suggestion
onKeyDown={(e) => {
if (e.key === "Enter") {
e.preventDefault();
if (!updateImageMutation.isPending) {
void handleRenameImage();
}
}
}}
```
### Issue 3 of 3
packages/ui/src/features/settings/sections/environments/useSandboxCustomImages.ts:160
**Partial Response Replaces Detail Cache**
If the PATCH endpoint returns only the updated fields, as the new client test permits, this call replaces the complete detail-cache object with `{ id, name }`. An open build-log view can then lose fields such as status and build output because this path invalidates only the list cache, not the detail entry.
Reviews (1): Last reviewed commit: "feat(cloud): rename custom sandbox env i..." | Re-trigger Greptile |
Add a rename action to the custom sandbox image list so users can update an image's display name without deleting and rebuilding it. Wired through a new updateSandboxCustomImage API client method that PATCHes the existing custom-image detail endpoint, plus an updateMutation hook and a rename AlertDialog mirroring the existing delete confirmation flow. The rename handler swallows the mutation rejection (onError shows the toast), the Enter key respects the pending guard, and the update mutation invalidates the detail cache rather than overwriting it with the PATCH response, so a partial response cannot drop cached fields.
tatoalo
force-pushed
the
posthog-code/rename-custom-env-images
branch
from
July 21, 2026 12:19
c0e6726 to
9e05615
Compare
There was a problem hiding this comment.
The code quality is solid and the bot-flagged P1/P2 issues were addressed, but the author is outside the owning team and this PR adds a new API contract method plus behavioral UI logic in the sandbox environments area, which requires a human reviewer familiar with that area before auto-approval.
skoob13
approved these changes
Jul 21, 2026
tatoalo
enabled auto-merge (squash)
July 21, 2026 13:41
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.
Problem
Custom sandbox base images in cloud environments could be created and deleted but never renamed.