Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions static/app/views/onboarding/createSampleEventButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import {t} from 'sentry/locale';
import type {Organization} from 'sentry/types/organization';
import type {Project} from 'sentry/types/project';
import {trackAnalytics} from 'sentry/utils/analytics';
import {browserHistory} from 'sentry/utils/browserHistory';
import {normalizeUrl} from 'sentry/utils/url/normalizeUrl';
import type {ReactRouter3Navigate} from 'sentry/utils/useNavigate';
import {useNavigate} from 'sentry/utils/useNavigate';
import {withApi} from 'sentry/utils/withApi';
import {withOrganization} from 'sentry/utils/withOrganization';

type CreateSampleEventButtonProps = ButtonProps & {
type CreateSampleEventButtonOuterProps = ButtonProps & {
api: Client;
organization: Organization;
source: string;
Expand All @@ -29,6 +30,10 @@ type CreateSampleEventButtonProps = ButtonProps & {
project?: Project;
};

type CreateSampleEventButtonProps = CreateSampleEventButtonOuterProps & {
navigate: ReactRouter3Navigate;
};

type State = {
creating: boolean;
};
Expand Down Expand Up @@ -190,7 +195,7 @@ class CreateSampleEventButton extends Component<CreateSampleEventButtonProps, St

this.props.onClick?.();

browserHistory.push(
this.props.navigate(
normalizeUrl(
`/organizations/${organization.slug}/issues/${eventData.groupID}/?project=${project.id}&referrer=sample-error`
)
Expand All @@ -200,6 +205,7 @@ class CreateSampleEventButton extends Component<CreateSampleEventButtonProps, St
render() {
const {
api: _api,
navigate: _navigate,
organization: _organization,
project: _project,
source: _source,
Expand All @@ -219,4 +225,12 @@ class CreateSampleEventButton extends Component<CreateSampleEventButtonProps, St
}
}

export default withApi(withOrganization(CreateSampleEventButton));
function CreateSampleEventButtonWithNavigate({
ref: _ref,
...props
}: CreateSampleEventButtonOuterProps) {
const navigate = useNavigate();
return <CreateSampleEventButton {...props} navigate={navigate} />;
}

export default withApi(withOrganization(CreateSampleEventButtonWithNavigate));
Loading