From 12113b685fcbd6abf8cd997fe2445f10722e481a Mon Sep 17 00:00:00 2001 From: Amogh Bharadwaj <65964360+Amogh-Bharadwaj@users.noreply.github.com> Date: Tue, 22 Oct 2024 21:31:07 +0530 Subject: [PATCH] Mirror stats: ensure we dont send nulls (#2169) Designing client side applications is tricky when you have to account for fields being undefined/null. This PR ensures that our stats endpoints return empty arrays at the very least --- flow/cmd/mirror_status.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/flow/cmd/mirror_status.go b/flow/cmd/mirror_status.go index abf6c95f87..70efa7597b 100644 --- a/flow/cmd/mirror_status.go +++ b/flow/cmd/mirror_status.go @@ -507,6 +507,10 @@ func (h *FlowRequestHandler) GetCDCBatches(ctx context.Context, req *protos.GetC return nil, err } + if batches == nil { + batches = []*protos.CDCBatch{} + } + return &protos.GetCDCBatchesResponse{ CdcBatches: batches, }, nil @@ -545,6 +549,10 @@ func (h *FlowRequestHandler) CDCTableTotalCounts( if err != nil { return nil, err } + + if tableCounts == nil { + tableCounts = []*protos.CDCTableRowCounts{} + } return &protos.CDCTableTotalCountsResponse{TotalData: &totalCount, TablesData: tableCounts}, nil }