|
@@ -26,16 +26,19 @@ function useReplaysCount({groupIds, transactionNames, organization, project}: Op
|
|
);
|
|
);
|
|
|
|
|
|
const [condition, fieldName] = useMemo(() => {
|
|
const [condition, fieldName] = useMemo(() => {
|
|
- if (groupIds !== undefined) {
|
|
|
|
|
|
+ if (groupIds === undefined && transactionNames === undefined) {
|
|
|
|
+ throw new Error('Missing groupId or transactionName in useReplaysCount()');
|
|
|
|
+ }
|
|
|
|
+ if (groupIds && groupIds.length) {
|
|
return [`issue.id:[${toArray(groupIds).join(',')}]`, 'issue.id'];
|
|
return [`issue.id:[${toArray(groupIds).join(',')}]`, 'issue.id'];
|
|
}
|
|
}
|
|
- if (transactionNames !== undefined) {
|
|
|
|
|
|
+ if (transactionNames && transactionNames.length) {
|
|
return [
|
|
return [
|
|
`event.type:transaction transaction:[${toArray(transactionNames).join(',')}]`,
|
|
`event.type:transaction transaction:[${toArray(transactionNames).join(',')}]`,
|
|
'transaction',
|
|
'transaction',
|
|
];
|
|
];
|
|
}
|
|
}
|
|
- throw new Error('Missing groupId or transactionName in useReplaysCount()');
|
|
|
|
|
|
+ return [null, null];
|
|
}, [groupIds, transactionNames]);
|
|
}, [groupIds, transactionNames]);
|
|
|
|
|
|
const eventView = useMemo(
|
|
const eventView = useMemo(
|
|
@@ -45,7 +48,7 @@ function useReplaysCount({groupIds, transactionNames, organization, project}: Op
|
|
id: '',
|
|
id: '',
|
|
name: `Errors within replay`,
|
|
name: `Errors within replay`,
|
|
version: 2,
|
|
version: 2,
|
|
- fields: ['count_unique(replayId)', fieldName],
|
|
|
|
|
|
+ fields: ['count_unique(replayId)', String(fieldName)],
|
|
query: `!replayId:"" ${condition}`,
|
|
query: `!replayId:"" ${condition}`,
|
|
projects: [],
|
|
projects: [],
|
|
},
|
|
},
|
|
@@ -56,6 +59,9 @@ function useReplaysCount({groupIds, transactionNames, organization, project}: Op
|
|
|
|
|
|
const fetchReplayCount = useCallback(async () => {
|
|
const fetchReplayCount = useCallback(async () => {
|
|
try {
|
|
try {
|
|
|
|
+ if (!condition || !fieldName) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
const [data] = await doDiscoverQuery<TableData>(
|
|
const [data] = await doDiscoverQuery<TableData>(
|
|
api,
|
|
api,
|
|
`/organizations/${organization.slug}/events/`,
|
|
`/organizations/${organization.slug}/events/`,
|
|
@@ -72,7 +78,7 @@ function useReplaysCount({groupIds, transactionNames, organization, project}: Op
|
|
} catch (err) {
|
|
} catch (err) {
|
|
Sentry.captureException(err);
|
|
Sentry.captureException(err);
|
|
}
|
|
}
|
|
- }, [api, location, organization.slug, fieldName, eventView]);
|
|
|
|
|
|
+ }, [api, location, organization.slug, condition, fieldName, eventView]);
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
const hasSessionReplay =
|
|
const hasSessionReplay =
|