Commit 48ca9e9
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
173 | 173 | | |
174 | 174 | | |
175 | 175 | | |
176 | | - | |
| 176 | + | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| |||
0 commit comments