@trackunit/react-core-contexts 2.2.20 → 2.2.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs.js CHANGED
@@ -44,7 +44,7 @@ const FeatureFlagProviderIrisApp = ({ children }) => {
44
44
  * This error link is used to capture error information, i. e. traceId, graphQL errors, network errors, etc.
45
45
  */
46
46
  const createErrorLink = ({ errorHandler, getToken, }) => {
47
- return error.onError(({ graphQLErrors, networkError, operation, forward }) => {
47
+ return error.onError(({ graphQLErrors, networkError, operation, response, forward }) => {
48
48
  if (networkError) {
49
49
  // We skip the error logging if the error is an AbortError
50
50
  if (networkError.name === "AbortError") {
@@ -78,6 +78,9 @@ const createErrorLink = ({ errorHandler, getToken, }) => {
78
78
  if (traceIds.length) {
79
79
  errorHandler.setTag("traceIds", traceIds.join(", "));
80
80
  }
81
+ else if (typeof response?.extensions?.traceId === "string") {
82
+ errorHandler.setTag("traceIds", response.extensions.traceId);
83
+ }
81
84
  errorHandler.addBreadcrumb({
82
85
  category: "GraphQL",
83
86
  message: "GraphQL Error",
@@ -109,21 +112,7 @@ const createErrorLink = ({ errorHandler, getToken, }) => {
109
112
  if (isMutation) {
110
113
  return;
111
114
  }
112
- // For queries, forward to allow retry and capture response extensions
113
- return forward(operation).map(response => {
114
- // Capture traceId from response extensions if not already found in errors
115
- if (graphQLErrors) {
116
- const traceId = response.extensions?.traceId;
117
- if (typeof traceId === "string") {
118
- // Check if we already have traceIds from the errors
119
- const hasTraceIdsFromErrors = graphQLErrors.some(error => "extensions" in error && error.extensions && typeof error.extensions.traceId === "string");
120
- if (!hasTraceIdsFromErrors) {
121
- errorHandler.setTag("traceIds", traceId);
122
- }
123
- }
124
- }
125
- return response;
126
- });
115
+ return forward(operation);
127
116
  });
128
117
  };
129
118
 
package/index.esm.js CHANGED
@@ -42,7 +42,7 @@ const FeatureFlagProviderIrisApp = ({ children }) => {
42
42
  * This error link is used to capture error information, i. e. traceId, graphQL errors, network errors, etc.
43
43
  */
44
44
  const createErrorLink = ({ errorHandler, getToken, }) => {
45
- return onError(({ graphQLErrors, networkError, operation, forward }) => {
45
+ return onError(({ graphQLErrors, networkError, operation, response, forward }) => {
46
46
  if (networkError) {
47
47
  // We skip the error logging if the error is an AbortError
48
48
  if (networkError.name === "AbortError") {
@@ -76,6 +76,9 @@ const createErrorLink = ({ errorHandler, getToken, }) => {
76
76
  if (traceIds.length) {
77
77
  errorHandler.setTag("traceIds", traceIds.join(", "));
78
78
  }
79
+ else if (typeof response?.extensions?.traceId === "string") {
80
+ errorHandler.setTag("traceIds", response.extensions.traceId);
81
+ }
79
82
  errorHandler.addBreadcrumb({
80
83
  category: "GraphQL",
81
84
  message: "GraphQL Error",
@@ -107,21 +110,7 @@ const createErrorLink = ({ errorHandler, getToken, }) => {
107
110
  if (isMutation) {
108
111
  return;
109
112
  }
110
- // For queries, forward to allow retry and capture response extensions
111
- return forward(operation).map(response => {
112
- // Capture traceId from response extensions if not already found in errors
113
- if (graphQLErrors) {
114
- const traceId = response.extensions?.traceId;
115
- if (typeof traceId === "string") {
116
- // Check if we already have traceIds from the errors
117
- const hasTraceIdsFromErrors = graphQLErrors.some(error => "extensions" in error && error.extensions && typeof error.extensions.traceId === "string");
118
- if (!hasTraceIdsFromErrors) {
119
- errorHandler.setTag("traceIds", traceId);
120
- }
121
- }
122
- }
123
- return response;
124
- });
113
+ return forward(operation);
125
114
  });
126
115
  };
127
116
 
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
1
  {
2
2
  "name": "@trackunit/react-core-contexts",
3
- "version": "2.2.20",
3
+ "version": "2.2.22",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
7
7
  "node": ">=24.x"
8
8
  },
9
9
  "dependencies": {
10
- "@trackunit/iris-app-api": "2.1.18",
11
- "@trackunit/iris-app-runtime-core-api": "1.16.86",
12
- "@trackunit/react-core-hooks": "1.18.18",
13
- "@trackunit/i18n-library-translation": "2.1.18",
14
- "@trackunit/react-components": "2.2.20",
15
- "@trackunit/iris-app-runtime-core": "1.17.87",
10
+ "@trackunit/iris-app-api": "2.1.20",
11
+ "@trackunit/iris-app-runtime-core-api": "1.16.88",
12
+ "@trackunit/react-core-hooks": "1.18.20",
13
+ "@trackunit/i18n-library-translation": "2.1.20",
14
+ "@trackunit/react-components": "2.2.22",
15
+ "@trackunit/iris-app-runtime-core": "1.17.89",
16
16
  "graphql-sse": "^2.5.4",
17
- "@trackunit/react-core-contexts-api": "1.17.86"
17
+ "@trackunit/react-core-contexts-api": "1.17.88"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@apollo/client": "^3.13.8",