feat(ui): Make stack trace preview work with Merged Issues
diff --git a/static/app/components/eventOrGroupTitle.tsx b/static/app/components/eventOrGroupTitle.tsx
index 4fce7f8dfa859..0c2d9aad8295a 100644
--- a/static/app/components/eventOrGroupTitle.tsx
+++ b/static/app/components/eventOrGroupTitle.tsx
@@ -2,6 +2,7 @@ import React from 'react';
 import styled from '@emotion/styled';
 
 import GuideAnchor from 'app/components/assistant/guideAnchor';
+import ProjectsStore from 'app/stores/projectsStore';
 import {Group, GroupTombstone, Organization} from 'app/types';
 import {Event} from 'app/types/event';
 import {getTitle} from 'app/utils/events';
@@ -35,11 +36,16 @@ class EventOrGroupTitle extends React.Component<Props> {
       guideAnchorName,
     } = this.props;
     const {title, subtitle} = getTitle(data as Event, organization);
+    const {id, eventID, groupID, projectID} = data as Event;
 
     const titleWithHoverStacktrace = (
       <StacktracePreview
         organization={organization}
-        issueId={data.id}
+        issueId={groupID ? groupID : id}
+        // we need eventId and projectSlug only when hovering over Event, not Group
+        // (different API call is made to get the stack trace then)
+        eventId={eventID}
+        projectSlug={eventID ? ProjectsStore.getById(projectID)?.slug : undefined}
         disablePreview={!withStackTracePreview}
       >
         {title}
diff --git a/static/app/components/stacktracePreview.tsx b/static/app/components/stacktracePreview.tsx
index 6eb66b6c722bc..de43a8bc73ff9 100644
--- a/static/app/components/stacktracePreview.tsx
+++ b/static/app/components/stacktracePreview.tsx
@@ -28,6 +28,8 @@ type Props = {
   api: Client;
   theme: Theme;
   disablePreview?: boolean;
+  eventId?: string;
+  projectSlug?: string;
 };
 
 type State = {
@@ -45,7 +47,9 @@ class StacktracePreview extends React.Component<Props, State> {
   loaderTimeout: number | null = null;
 
   fetchData = async () => {
-    if (this.state.event) {
+    const {organization, api, issueId, eventId, projectSlug} = this.props;
+
+    if (this.state.event || (!issueId && !(eventId && projectSlug))) {
       return;
     }
 
@@ -53,9 +57,12 @@ class StacktracePreview extends React.Component<Props, State> {
       this.setState({loadingVisible: true});
     }, HOVERCARD_DELAY);
 
-    const {api, issueId} = this.props;
     try {
-      const event = await api.requestPromise(`/issues/${issueId}/events/latest/`);
+      const event = await api.requestPromise(
+        eventId && projectSlug
+          ? `/projects/${organization.slug}/${projectSlug}/events/${eventId}/`
+          : `/issues/${issueId}/events/latest/`
+      );
       clearTimeout(this.loaderTimeout);
       this.setState({event, loading: false, loadingVisible: false});
     } catch {

Adding stack trace preview support to Merged Issues:

![image](https://user-images.githubusercontent.com/9060071/114889212-33273080-9e0a-11eb-8f13-60bb6ccc331e.png)
