Browse Source

ref(replay): Pass in a path to query when loading a list of replays (#65981)

Depends on https://github.com/getsentry/sentry/pull/66086
Fixes https://github.com/getsentry/sentry/issues/65888
Ryan Albrecht 1 year ago
parent
commit
38029c4128

+ 6 - 3
static/app/utils/replays/fetchReplayList.tsx

@@ -7,7 +7,7 @@ import type {Organization} from 'sentry/types';
 import type EventView from 'sentry/utils/discover/eventView';
 import {mapResponseToReplayRecord} from 'sentry/utils/replays/replayDataUtils';
 import type RequestError from 'sentry/utils/requestError/requestError';
-import type {ReplayListRecord} from 'sentry/views/replays/types';
+import type {ReplayListQueryReferrer, ReplayListRecord} from 'sentry/views/replays/types';
 
 export const DEFAULT_SORT = '-started_at';
 
@@ -25,7 +25,7 @@ type Props = {
   location: Location;
   organization: Organization;
   perPage?: number;
-  queryReferrer?: 'issueReplays';
+  queryReferrer?: ReplayListQueryReferrer;
 };
 
 async function fetchReplayList({
@@ -59,7 +59,10 @@ async function fetchReplayList({
         // when queryReferrer === 'issueReplays' we override the global view check on the backend
         // we also require a project param otherwise we won't yield results
         queryReferrer,
-        project: queryReferrer === 'issueReplays' ? ALL_ACCESS_PROJECTS : payload.project,
+        project:
+          queryReferrer === 'issueReplays' || queryReferrer === 'transactionReplays'
+            ? ALL_ACCESS_PROJECTS
+            : payload.project,
       },
     });
 

+ 5 - 2
static/app/utils/replays/hooks/useReplayList.tsx

@@ -5,14 +5,17 @@ import type {Organization} from 'sentry/types';
 import type EventView from 'sentry/utils/discover/eventView';
 import fetchReplayList from 'sentry/utils/replays/fetchReplayList';
 import useApi from 'sentry/utils/useApi';
-import type {ReplayListLocationQuery} from 'sentry/views/replays/types';
+import type {
+  ReplayListLocationQuery,
+  ReplayListQueryReferrer,
+} from 'sentry/views/replays/types';
 
 type Options = {
   eventView: EventView;
   location: Location<ReplayListLocationQuery>;
   organization: Organization;
   perPage?: number;
-  queryReferrer?: 'issueReplays';
+  queryReferrer?: ReplayListQueryReferrer;
 };
 
 type State = Awaited<ReturnType<typeof fetchReplayList>> & {isFetching: boolean};

+ 1 - 0
static/app/views/performance/transactionSummary/transactionReplays/transactionReplays.tsx

@@ -144,6 +144,7 @@ function ReplaysContent({
     eventView,
     location,
     organization,
+    queryReferrer: 'transactionReplays',
   });
 
   const replaysWithTx = useReplaysWithTxData({

+ 2 - 0
static/app/views/replays/types.tsx

@@ -108,6 +108,8 @@ export type ReplayListLocationQuery = {
   utc?: 'true' | 'false';
 };
 
+export type ReplayListQueryReferrer = 'issueReplays' | 'transactionReplays';
+
 // Sync with ReplayListRecord below
 export const REPLAY_LIST_FIELDS = [
   'activity',