|
@@ -1,4 +1,4 @@
|
|
|
-import {useEffect} from 'react';
|
|
|
+import {useCallback, useEffect} from 'react';
|
|
|
import styled from '@emotion/styled';
|
|
|
import * as Sentry from '@sentry/react';
|
|
|
|
|
@@ -11,17 +11,21 @@ import {useFeedbackOnboardingSidebarPanel} from 'sentry/components/feedback/useF
|
|
|
import OnboardingPanel from 'sentry/components/onboardingPanel';
|
|
|
import {t} from 'sentry/locale';
|
|
|
import {trackAnalytics} from 'sentry/utils/analytics';
|
|
|
+import {useLocation} from 'sentry/utils/useLocation';
|
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
|
import useProjects from 'sentry/utils/useProjects';
|
|
|
+import useRouter from 'sentry/utils/useRouter';
|
|
|
|
|
|
type Props = {
|
|
|
+ issueTab?: boolean;
|
|
|
projectIds?: string[];
|
|
|
};
|
|
|
|
|
|
-export function UserFeedbackEmpty({projectIds}: Props) {
|
|
|
+export function UserFeedbackEmpty({projectIds, issueTab = false}: Props) {
|
|
|
const {projects, initiallyLoaded} = useProjects();
|
|
|
const loadingProjects = !initiallyLoaded;
|
|
|
const organization = useOrganization();
|
|
|
+ const location = useLocation();
|
|
|
|
|
|
const selectedProjects = projectIds?.length
|
|
|
? projects.filter(({id}) => projectIds.includes(id))
|
|
@@ -31,6 +35,22 @@ export function UserFeedbackEmpty({projectIds}: Props) {
|
|
|
const hasNewOnboarding = organization.features.includes('user-feedback-onboarding');
|
|
|
const {activateSidebarIssueDetails} = useFeedbackOnboardingSidebarPanel();
|
|
|
|
|
|
+ const router = useRouter();
|
|
|
+ const setProjId = useCallback(() => {
|
|
|
+ router.push({
|
|
|
+ pathname: location.pathname,
|
|
|
+ query: {...location.query, project: projectIds?.[0]},
|
|
|
+ hash: location.hash,
|
|
|
+ });
|
|
|
+ }, [location.hash, location.query, location.pathname, projectIds, router]);
|
|
|
+
|
|
|
+ useEffect(() => {
|
|
|
+ if (issueTab) {
|
|
|
+ setProjId();
|
|
|
+ }
|
|
|
+ // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
+ }, []);
|
|
|
+
|
|
|
useEffect(() => {
|
|
|
window.sentryEmbedCallback = function (embed) {
|
|
|
// Mock the embed's submit xhr to always be successful
|