diff --git a/ui/app/api/mirrors/route.ts b/ui/app/api/mirrors/route.ts index 6b7e8f4253..f9ca2f1911 100644 --- a/ui/app/api/mirrors/route.ts +++ b/ui/app/api/mirrors/route.ts @@ -3,6 +3,15 @@ import prisma from '@/app/utils/prisma'; export const dynamic = 'force-dynamic'; +const stringifyConfig = (flowArray: any[]) => { + flowArray.forEach((flow) => { + if (flow.config_proto) { + flow.config_proto = new TextDecoder().decode(flow.config_proto); + } + }); + return flowArray; +}; + export async function GET(request: Request) { const mirrors = await prisma.flows.findMany({ distinct: 'name', @@ -20,5 +29,5 @@ export async function GET(request: Request) { }; return newMirror; }); - return new Response(JSON.stringify(flows)); + return new Response(JSON.stringify(stringifyConfig(flows))); } diff --git a/ui/app/mirrors/page.tsx b/ui/app/mirrors/page.tsx index e4cb5318a6..b6ed706de9 100644 --- a/ui/app/mirrors/page.tsx +++ b/ui/app/mirrors/page.tsx @@ -14,13 +14,6 @@ import { CDCFlows, QRepFlows } from './tables'; export const dynamic = 'force-dynamic'; const fetcher = (...args: [any]) => fetch(...args).then((res) => res.json()); -const stringifyConfig = (flowArray: any[]) => { - flowArray.forEach((flow) => { - if (flow.config_proto) { - flow.config_proto = new TextDecoder().decode(flow.config_proto); - } - }); -}; export default function Mirrors() { const { @@ -53,12 +46,6 @@ export default function Mirrors() { return false; }); - if (!isLoading) { - stringifyConfig(cdcFlows); - stringifyConfig(qrepFlows); - stringifyConfig(xminFlows); - } - return (