useReplayErrors.tsx 817 B

123456789101112131415161718192021222324252627282930
  1. import {useMemo} from 'react';
  2. import {ReplayError} from 'sentry/views/replays/types';
  3. import useDiscoverQuery from './useDiscoveryQuery';
  4. interface Params {
  5. replayId: string;
  6. ignoreCursor?: boolean;
  7. }
  8. /**
  9. * Fetches a list of errors that occurred in a replay
  10. */
  11. export default function useReplayErrors({replayId, ...props}: Params) {
  12. const discoverQuery = useMemo(
  13. () => ({
  14. query: `replayId:${replayId} AND event.type:error`,
  15. fields: ['event.id', 'error.value', 'timestamp', 'error.type', 'issue.id'],
  16. // environment and project shouldn't matter because having a replayId
  17. // assumes we have already filtered down to proper env/project
  18. environment: [],
  19. projects: [],
  20. }),
  21. [replayId]
  22. );
  23. return useDiscoverQuery<ReplayError>({discoverQuery, ...props});
  24. }