fix(web): gate zone-records fetch to no-template case; wait for domains load before branching

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-05 12:28:07 +07:00
parent c2832348f8
commit 137113cbe6
3 changed files with 44 additions and 3 deletions
+15 -1
View File
@@ -31,7 +31,10 @@ export function DomainDiffPage() {
const check = useCheckDomain(id, hasTemplate)
const apply = useApplyDomain(id)
const zoneRecords = useZoneRecords(id)
// Пока список доменов не загружен, hasTemplate недостоверно (false по
// умолчанию из-за domain === undefined) — не дёргаем provider-запрос
// записей зоны, пока не будет точно известно, что шаблона нет.
const zoneRecords = useZoneRecords(id, !domains.isPending && !hasTemplate)
const createTemplateFromZone = useCreateTemplateFromZone()
const [applyPrunes, setApplyPrunes] = useState(false)
const pruneCheckboxId = useId()
@@ -50,6 +53,17 @@ export function DomainDiffPage() {
createTemplateFromZone.mutate(id)
}
if (domains.isPending) {
return (
<div className="mx-auto flex max-w-3xl flex-col gap-6 px-6 py-8">
<div className="flex items-center gap-2 rounded-lg border border-border bg-card px-4 py-8 text-sm text-muted-foreground">
<Loader2 className="size-4 animate-spin" strokeWidth={1.75} />
Загрузка
</div>
</div>
)
}
return (
<div className="mx-auto flex max-w-3xl flex-col gap-6 px-6 py-8">
<header className="flex flex-wrap items-end justify-between gap-4">