From 5a28a8439c510a2c313e5bd2fa899e4798a759e6 Mon Sep 17 00:00:00 2001 From: GnsP Date: Mon, 16 Feb 2026 16:18:18 +0530 Subject: [PATCH] fix error handling and add 5min timeout for the requests from graphql server --- .../components/PipelineList/DeployedPipelineView/index.tsx | 5 +++-- graphql/resolvers-common.js | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/cdap/components/PipelineList/DeployedPipelineView/index.tsx b/app/cdap/components/PipelineList/DeployedPipelineView/index.tsx index 9b79d6cbddc..b4a270f6c6e 100644 --- a/app/cdap/components/PipelineList/DeployedPipelineView/index.tsx +++ b/app/cdap/components/PipelineList/DeployedPipelineView/index.tsx @@ -94,7 +94,7 @@ const checkError = (error) => { } else { // Pick one of the leftover errors to show in the banner; const errs = Object.values(errorMap); - return errs ? errs[0][0] : 'Unknown error'; + return errs?.[0]?.[0] ? errs[0][0] : 'Unknown error'; } } } @@ -156,7 +156,8 @@ const DeployedPipeline: React.FC = () => { ); const { loading, error, data, refetch, networkStatus } = useQuery(QUERY, { errorPolicy: 'all', - fetchPolicy: 'no-cache', + fetchPolicy: 'cache-and-network', + nextFetchPolicy: 'cache-first', notifyOnNetworkStatusChange: true, variables: { nameFilter: search || undefined, diff --git a/graphql/resolvers-common.js b/graphql/resolvers-common.js index 5919d1976e6..60d13599932 100644 --- a/graphql/resolvers-common.js +++ b/graphql/resolvers-common.js @@ -43,6 +43,10 @@ export function requestPromiseWrapper(options, { auth: token, userIdProperty, us options.headers[userIdProperty] = userIdValue; } + if (!options.timeout) { + options.timeout = 5 * 60 * 1000; // 5mins + } + return new Promise((resolve, reject) => { request(options, (err, response, body) => { const statusCode = response.statusCode;