fix: use v2 template update endpoint to prevent ID alias insertion#284
fix: use v2 template update endpoint to prevent ID alias insertion#284ben-fornefeld merged 2 commits intomainfrom
Conversation
Co-authored-by: Berry <beran-t@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
LGTM — straightforward fix that correctly filters the template ID from the display names list while preserving fallback behavior.
Extended reasoning...
Overview
Single-file change in src/features/dashboard/templates/list/table-cells.tsx modifying only the TemplateNameCell component. The fix adds a pre-filter step before selecting the primary display name: it removes the raw templateID from the names array, then falls back to the original names array if no other entries remain.
Security Risks
None. This is a pure display/rendering change with no auth, data mutation, or external calls involved.
Level of Scrutiny
Low. The logic is simple, self-contained, and the fallback path is preserved exactly as before. The change directly addresses the described bug (template ID being shown as the primary name instead of human-readable aliases after toggling public status).
Other Factors
No bugs were found by the automated bug hunting system. The PR is a single-file UI fix with a clear causal link between the code change and the described problem. The additionalNames computation also correctly uses displayNames after the change, keeping the tooltip list consistent.
Switch from PATCH /templates/{templateID} (v1) to PATCH /v2/templates/{templateID}.
The v1 endpoint creates a base alias from the templateID, which inserts
the bare ID into env_aliases and causes it to appear as a name.
Revert the client-side workaround in TemplateNameCell since the root
cause is now addressed server-side.
Co-Authored-By: ben@e2b.dev <ben@e2b.dev>
Summary
When toggling a template's visibility to public via the dashboard, the v1
PATCH /templates/{templateID}endpoint creates a "base alias" from the templateID, inserting the bare ID intoenv_aliases. This causes the template ID to appear as a name in the Name column.This PR switches the
updateTemplatemutation to usePATCH /v2/templates/{templateID}, which does not have this side effect.The previous client-side workaround (filtering templateID out of
namesinTemplateNameCell) has been reverted since the root cause is now addressed at the API layer.Slack Thread
Review & Testing Checklist for Human
env_aliases(this requires checking the DB or observing the Name column after toggling)Suggested test plan: Toggle an existing template's visibility to public via the dashboard, then refresh the templates list. The Name column should show the human-readable alias, not the raw template ID.
Notes
TemplateUpdateRequestbody ({ public: boolean }) but returns aTemplateUpdateResponsewithnames: string[]. The calling code only checks for success/error status, so the different response shape has no impact.Link to Devin session: https://app.devin.ai/sessions/c52f804e1cdb4ba5b4db88d3be77fa0b