Skip to content

Fix error_tracking details link generation logic

Daniele Rossetti requested to merge rossetd/fix-error-tracking-details-link into master

What does this MR do and why?

Improve error_tracking details link generation logic. It fixes a bug reported at #430211 (closed) , where having a trailing / in the URL would cause the details link not to work correctly (404 returned)

Screenshots or screen recordings

NA

How to set up and validate locally

Apply patch to apply mocks pbpaste | git apply --allow-empty

diff --git a/app/assets/javascripts/error_tracking/store/list/actions.js b/app/assets/javascripts/error_tracking/store/list/actions.js
index 84e4463ca216..c73344ce2bac 100644
--- a/app/assets/javascripts/error_tracking/store/list/actions.js
+++ b/app/assets/javascripts/error_tracking/store/list/actions.js
@@ -9,37 +9,65 @@ let eTagPoll;
 export function startPolling({ state, commit, dispatch }) {
   commit(types.SET_LOADING, true);
 
-  eTagPoll = new Poll({
-    resource: Service,
-    method: 'getSentryData',
-    data: {
-      endpoint: state.endpoint,
-      params: {
-        search_term: state.searchQuery,
-        sort: state.sortField,
-        cursor: state.cursor,
-        issue_status: state.statusFilter,
+  const data = {
+    errors: [
+      {
+        id: '2650783669',
+        title: __('Error'),
+        type: null,
+        user_count: 1,
+        count: 2,
+        first_seen: '2023-04-20T17:00:48.261Z',
+        last_seen: '2023-04-20T17:00:50.941Z',
+        message: 'Hello from ReactSDK',
+        culprit: './src/index.js()',
+        external_url: null,
+        project_id: null,
+        project_name: null,
+        project_slug: null,
+        short_id: null,
+        status: 'unresolved',
+        frequency: null,
       },
-    },
-    successCallback: ({ data }) => {
-      if (!data) {
-        return;
-      }
-
-      commit(types.SET_PAGINATION, data.pagination);
-      commit(types.SET_ERRORS, data.errors);
-      commit(types.SET_LOADING, false);
-      dispatch('stopPolling');
-    },
-    errorCallback: () => {
-      commit(types.SET_LOADING, false);
-      createAlert({
-        message: __('Failed to load errors from Sentry.'),
-      });
-    },
-  });
-
-  eTagPoll.makeRequest();
+    ],
+    pagination: {},
+    external_url: null,
+  };
+
+  commit(types.SET_ERRORS, data.errors);
+  commit(types.SET_LOADING, false);
+
+  // eTagPoll = new Poll({
+  //   resource: Service,
+  //   method: 'getSentryData',
+  //   data: {
+  //     endpoint: state.endpoint,
+  //     params: {
+  //       search_term: state.searchQuery,
+  //       sort: state.sortField,
+  //       cursor: state.cursor,
+  //       issue_status: state.statusFilter,
+  //     },
+  //   },
+  //   successCallback: ({ data }) => {
+  //     if (!data) {
+  //       return;
+  //     }
+
+  //     commit(types.SET_PAGINATION, data.pagination);
+  //     commit(types.SET_ERRORS, data.errors);
+  //     commit(types.SET_LOADING, false);
+  //     dispatch('stopPolling');
+  //   },
+  //   errorCallback: () => {
+  //     commit(types.SET_LOADING, false);
+  //     createAlert({
+  //       message: __('Failed to load errors from Sentry.'),
+  //     });
+  //   },
+  // });
+
+  // eTagPoll.makeRequest();
 }
 
 export const stopPolling = () => {

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Daniele Rossetti

Merge request reports