fix(custom-metrics): say "name taken" only for a name clash

The form read every 409 as "a metric with this name already exists".
Now that it keeps one idempotency key across taps, a second tap while
the first create is still running also answers 409, and the form told
the person their name was taken. The create and rename routes send
`customMetric.name_taken` with the clash, and the form matches the code.
This commit is contained in:
Marc-André Bombeck committed 2026-11-12 12:52:39 +01:00
1 parent 671245c782
commit 706af61cdd
6 files changed
+14 -3

No files matched your search

@@ -132,8 +132,10 @@ export function CustomMetricForm({
);
onSuccess?.(saved);
} catch (err) {
// By its code: a 409 can also be the first save still running.
setError(
err instanceof ApiError && err.status === 409
err instanceof ApiError &&
err.meta?.errorCode === "customMetric.name_taken"
? t("customMetrics.form.nameTaken")
: localizedApiError(err, t, "customMetrics.form.saveError"),
);