Browse Source

fix(issues): Fix prompt stacktrace link query (#42116)

Scott Cooper 2 years ago
parent
commit
6425f53aa4

+ 3 - 3
static/app/actionCreators/prompts.tsx

@@ -1,5 +1,5 @@
 import type {Client} from 'sentry/api';
-import {useQuery} from 'sentry/utils/queryClient';
+import {QueryKey, useQuery} from 'sentry/utils/queryClient';
 
 type PromptsUpdateParams = {
   /**
@@ -92,9 +92,9 @@ export const makePromptsCheckQueryKey = ({
   feature,
   organizationId,
   projectId,
-}: PromptCheckParams): [string, Record<string, string | undefined>] => [
+}: PromptCheckParams): QueryKey => [
   '/prompts-activity/',
-  {feature, organizationId, projectId},
+  {query: {feature, organizationId, projectId}},
 ];
 
 /**

+ 10 - 0
static/app/components/events/interfaces/frame/stacktraceLink.spec.tsx

@@ -60,6 +60,16 @@ describe('StacktraceLink', function () {
       })
     );
     expect(promptActivity).toHaveBeenCalledTimes(1);
+    expect(promptActivity).toHaveBeenCalledWith(
+      '/prompts-activity/',
+      expect.objectContaining({
+        query: {
+          feature: 'stacktrace_link',
+          organizationId: org.id,
+          projectId: project.id,
+        },
+      })
+    );
     expect(analyticsSpy).toHaveBeenCalledTimes(1);
   });
 

+ 1 - 1
static/app/utils/queryClient.tsx

@@ -8,7 +8,7 @@ type QueryKeyEndpointOptions = {
   query?: Record<string, any>;
 };
 
-type QueryKey =
+export type QueryKey =
   | readonly [url: string]
   | readonly [url: string, options: QueryKeyEndpointOptions];