diff --git a/app/routes/_data.dns._index/nameservers.tsx b/app/routes/_data.dns._index/nameservers.tsx index 45ce719..7deb03b 100644 --- a/app/routes/_data.dns._index/nameservers.tsx +++ b/app/routes/_data.dns._index/nameservers.tsx @@ -91,9 +91,9 @@ function NameserverList({ isGlobal, isDisabled, nameservers, name }: ListProps) }) } else { const key = `dns.nameservers.split."${name}"` + const list = nameservers.filter((_, i) => i !== index) submit({ - [key]: nameservers - .filter((_, i) => i !== index), + [key]: list.length ? list : null, }, { method: 'PATCH', encType: 'application/json', diff --git a/app/utils/config/headscale.ts b/app/utils/config/headscale.ts index 20d8cbe..d3455a8 100644 --- a/app/utils/config/headscale.ts +++ b/app/utils/config/headscale.ts @@ -308,6 +308,11 @@ export async function patchConfig(partial: Record) { // Push the remaining element path.push(temp.replaceAll('"', '')) + if (value === null) { + configYaml.deleteIn(path) + continue + } + configYaml.setIn(path, value) }