Skip to content

Commit 48ca9e9

Browse files
beran-tcursoragentdevin-ai-integration[bot]ben-fornefeld
authored
fix: use v2 template update endpoint to prevent ID alias insertion (#284)
## 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 into `env_aliases`. This causes the template ID to appear as a name in the Name column. This PR switches the `updateTemplate` mutation to use `PATCH /v2/templates/{templateID}`, which does not have this side effect. The previous client-side workaround (filtering templateID out of `names` in `TemplateNameCell`) has been reverted since the root cause is now addressed at the API layer. [Slack Thread](https://e2b-team.slack.com/archives/C086YA5T4JD/p1774979680231699?thread_ts=1774979680.231699&cid=C086YA5T4JD) ## Review & Testing Checklist for Human - [ ] Verify that toggling a template to **public** via the dashboard no longer inserts the template ID as a name in `env_aliases` (this requires checking the DB or observing the Name column after toggling) - [ ] Verify that toggling a template to **internal** (private) still works correctly with the v2 endpoint - [ ] Confirm the v2 endpoint is available and stable in all target environments (staging/production) **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 - The v2 endpoint uses the same `TemplateUpdateRequest` body (`{ public: boolean }`) but returns a `TemplateUpdateResponse` with `names: string[]`. The calling code only checks for success/error status, so the different response shape has no impact. - Templates that already had the ID inserted as an alias (from prior v1 calls) will still show the ID until those stale aliases are cleaned up separately. Link to Devin session: https://app.devin.ai/sessions/c52f804e1cdb4ba5b4db88d3be77fa0b --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Berry <beran-t@users.noreply.github.com> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: ben@e2b.dev <ben@e2b.dev>
1 parent 256403d commit 48ca9e9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/server/api/routers/templates.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export const templatesRouter = createTRPCRouter({
145145
const { session, teamId } = ctx
146146
const { templateId, public: isPublic } = input
147147

148-
const res = await infra.PATCH('/templates/{templateID}', {
148+
const res = await infra.PATCH('/v2/templates/{templateID}', {
149149
body: {
150150
public: isPublic,
151151
},
@@ -173,7 +173,7 @@ export const templatesRouter = createTRPCRouter({
173173
status,
174174
},
175175
},
176-
`failed to patch /templates/{templateID}: ${res.error?.message || 'Unknown error'}`
176+
`failed to patch /v2/templates/{templateID}: ${res.error?.message || 'Unknown error'}`
177177
)
178178

179179
if (status === 404) {

0 commit comments

Comments
 (0)