fix: empty changeset must serialize as [] not null (white-screen after snapshot)
toChangesetResponse initialises updates/prunes/readOnly so a zone matching its template exactly (e.g. right after 'create template from zone') marshals arrays, not null. DiffView/DomainDiffPage also normalise null defensively. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BwxdSt4reTm7Dj1oxRvpP3
This commit is contained in:
@@ -137,11 +137,13 @@ export function DiffView({
|
||||
changeset: ChangesetResponse
|
||||
footerExtra?: ReactNode
|
||||
}) {
|
||||
// Defensive: a field may arrive as null (e.g. a nil slice from an older
|
||||
// backend) — normalise to [] so Section never calls .length/.map on null.
|
||||
return (
|
||||
<div className="flex flex-col gap-6">
|
||||
<Section tone="update" records={changeset.updates} />
|
||||
<Section tone="delete" records={changeset.prunes} />
|
||||
<Section tone="readonly" records={changeset.readOnly} />
|
||||
<Section tone="update" records={changeset.updates ?? []} />
|
||||
<Section tone="delete" records={changeset.prunes ?? []} />
|
||||
<Section tone="readonly" records={changeset.readOnly ?? []} />
|
||||
|
||||
<div className="flex items-center justify-between gap-3 border-t border-border pt-4">
|
||||
<div className="flex items-center gap-1.5 text-sm text-muted-foreground">
|
||||
|
||||
Reference in New Issue
Block a user