From 18f0c881918bffdcc7be555ead5e1ca03392cbb7 Mon Sep 17 00:00:00 2001 From: tealjulia Date: Mon, 12 Dec 2022 15:52:27 -0500 Subject: [PATCH 1/2] match by name and namespace, not index --- .../connection/CatalogTree/CatalogTree.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/airbyte-webapp/src/components/connection/CatalogTree/CatalogTree.tsx b/airbyte-webapp/src/components/connection/CatalogTree/CatalogTree.tsx index ad8340e0745a9..0217cd86df3a9 100644 --- a/airbyte-webapp/src/components/connection/CatalogTree/CatalogTree.tsx +++ b/airbyte-webapp/src/components/connection/CatalogTree/CatalogTree.tsx @@ -56,8 +56,20 @@ const CatalogTreeComponent: React.FC> const changedStreams = useMemo( () => - streams.filter((stream, idx) => { - return stream.config?.selected !== initialValues.syncCatalog.streams[idx].config?.selected; + streams.filter((stream) => { + if (!stream.config) { + return false; + } + const matchingInitialValue = initialValues.syncCatalog.streams.filter( + (initialStream) => + initialStream.stream?.name === stream.stream?.name && + initialStream.stream?.namespace === stream.stream?.namespace + )[0]; + if (!matchingInitialValue) { + return false; + } + + return stream.config?.selected !== matchingInitialValue.config?.selected; }), [initialValues.syncCatalog.streams, streams] ); From d77fe4d6efece22c350a2cd4159b4cf654ea7ec1 Mon Sep 17 00:00:00 2001 From: tealjulia Date: Mon, 12 Dec 2022 16:41:37 -0500 Subject: [PATCH 2/2] streamline per PR review --- .../connection/CatalogTree/CatalogTree.tsx | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/airbyte-webapp/src/components/connection/CatalogTree/CatalogTree.tsx b/airbyte-webapp/src/components/connection/CatalogTree/CatalogTree.tsx index 0217cd86df3a9..afc667ba0a7c1 100644 --- a/airbyte-webapp/src/components/connection/CatalogTree/CatalogTree.tsx +++ b/airbyte-webapp/src/components/connection/CatalogTree/CatalogTree.tsx @@ -57,19 +57,12 @@ const CatalogTreeComponent: React.FC> const changedStreams = useMemo( () => streams.filter((stream) => { - if (!stream.config) { - return false; - } - const matchingInitialValue = initialValues.syncCatalog.streams.filter( + const matchingInitialValue = initialValues.syncCatalog.streams.find( (initialStream) => initialStream.stream?.name === stream.stream?.name && initialStream.stream?.namespace === stream.stream?.namespace - )[0]; - if (!matchingInitialValue) { - return false; - } - - return stream.config?.selected !== matchingInitialValue.config?.selected; + ); + return stream.config?.selected !== matchingInitialValue?.config?.selected; }), [initialValues.syncCatalog.streams, streams] );