diff --git a/packages/mco/components/mco-dashboard/data-policy/dr-dashboard.tsx b/packages/mco/components/mco-dashboard/data-policy/dr-dashboard.tsx
index a3b010d5a..acfd4599e 100644
--- a/packages/mco/components/mco-dashboard/data-policy/dr-dashboard.tsx
+++ b/packages/mco/components/mco-dashboard/data-policy/dr-dashboard.tsx
@@ -63,14 +63,30 @@ const UpperSection: React.FC = () => (
);
-export const DRDashboard: React.FC = () => {
+const CSVStatusesContextProvider: React.FC<{ children: React.ReactNode }> = ({
+ children,
+}) => {
const [csvData, csvError, csvLoading] = useCustomPrometheusPoll({
endpoint: 'api/v1/query' as any,
query: STATUS_QUERIES[StorageDashboard.CSV_STATUS_ALL_WHITELISTED],
basePath: ACM_ENDPOINT,
cluster: HUB_CLUSTER_NAME,
});
+ const contextValue = React.useMemo(
+ () => ({ csvData, csvError, csvLoading }),
+ [csvData, csvError, csvLoading]
+ );
+
+ return (
+
+ {children}
+
+ );
+};
+const DRResourcesContextProvider: React.FC<{ children: React.ReactNode }> = ({
+ children,
+}) => {
const [drResources, drLoaded, drLoadError] =
useDisasterRecoveryResourceWatch();
const [argoApplicationSetResources, loaded, loadError] =
@@ -159,21 +175,28 @@ export const DRDashboard: React.FC = () => {
loadError,
]);
- const dRResourcesContext = {
- drClusterAppsMap,
- loaded,
- loadError,
- };
+ const contextValue = React.useMemo(
+ () => ({ drClusterAppsMap, loaded, loadError }),
+ [drClusterAppsMap, loaded, loadError]
+ );
+
+ return (
+
+ {children}
+
+ );
+};
+const DRDashboard: React.FC = () => {
// ToDo(Sanjal): combime multiple Context together to make it scalable
// refer: https://javascript.plainenglish.io/how-to-combine-context-providers-for-cleaner-react-code-9ed24f20225e
return (
-
-
+
+
-
-
+
+
);
};
diff --git a/packages/odf/components/topology/Topology.tsx b/packages/odf/components/topology/Topology.tsx
index 928072583..b1a663aa6 100644
--- a/packages/odf/components/topology/Topology.tsx
+++ b/packages/odf/components/topology/Topology.tsx
@@ -531,24 +531,53 @@ const Topology: React.FC = () => {
const zones = memoizedNodes.map(getTopologyDomain);
+ const TopologyDataContextProvider: React.FC<{ children: React.ReactNode }> =
+ ({ children }) => {
+ const contextValue = React.useMemo(
+ () => ({
+ nodes: memoizedNodes,
+ storageCluster: storageCluster[0],
+ zones,
+ deployments: memoizedDeployments,
+ visualizationLevel: visualizationLevel,
+ activeNode,
+ setActiveNode,
+ nodeDeploymentMap,
+ selectedElement,
+ setSelectedElement,
+ }),
+ []
+ );
+
+ return (
+
+ {children}
+
+ );
+ };
+
+ const TopologySearchContextProvider: React.FC<{ children: React.ReactNode }> =
+ ({ children }) => {
+ const contextValue = React.useMemo(
+ () => ({
+ activeItemsUID,
+ setActiveItemsUID,
+ activeItem,
+ setActiveItem,
+ }),
+ [activeItemsUID, setActiveItemsUID, activeItem, setActiveItem]
+ );
+
+ return (
+
+ {children}
+
+ );
+ };
+
return (
-
-
+
+
@@ -569,8 +598,8 @@ const Topology: React.FC = () => {
-
-
+
+
);
};