Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@sentry/node": "^7.109.0",
"@sentry/react": "^7.109.0",
"@sentry/release-parser": "^1.3.1",
"@sentry/status-page-list": "^0.0.1",
"@sentry/types": "^7.109.0",
"@sentry/utils": "^7.109.0",
"@spotlightjs/spotlight": "^1.2.13",
Expand Down
12 changes: 10 additions & 2 deletions static/app/views/performance/http/domainStatusLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ import ExternalLink from 'sentry/components/links/externalLink';
import {IconOpen} from 'sentry/icons';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import {DOMAIN_STATUS_PAGE_URLS} from 'sentry/views/performance/http/domainStatusPageURLs';
import {useStatusPageList} from 'sentry/views/performance/http/useStatusPageList';

interface Props {
domain?: string;
}

export function DomainStatusLink({domain}: Props) {
const statusPageList = useStatusPageList();

if (!domain) {
return null;
}

const statusPageURL = statusPageList?.domainToStatusPageUrls?.[domain];

if (!statusPageURL) {
return null;
}

return (
<ExternalDomainLink href={DOMAIN_STATUS_PAGE_URLS[domain]}>
<ExternalDomainLink href={statusPageURL}>
{t('Status')}
<IconOpen />
</ExternalDomainLink>
Expand Down
8 changes: 0 additions & 8 deletions static/app/views/performance/http/domainStatusPageURLs.tsx

This file was deleted.

22 changes: 22 additions & 0 deletions static/app/views/performance/http/useStatusPageList.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {useCallback, useEffect, useState} from 'react';

import {useIsMountedRef} from 'sentry/utils/useIsMountedRef';

export function useStatusPageList() {
const isMountedRef = useIsMountedRef();
const [mod, setMod] = useState<any>({});

const loader = useCallback(async () => {
const loaded = await import('@sentry/status-page-list');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems excessive to load what an object with 50 things in it, assuming we can tree shake the rest of it. We might need this getsentry/status-page-list#6

Performance page routes are already lazy loaded.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what i'm saying is it might be fine to just import {domainToStatusPageUrls} from '@sentry/status-page-list'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@scttcper I'm happy to follow whatever you think is best!

The docs in status-page-list suggested to load async, which seems sound since that package is going to grow and we probably can't tree-shake it, since we don't know which domains we need ahead of time, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah was thinking mostly of shaking everything else

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, roger! Will update the dependency if/when getsentry/status-page-list#6 is merged, then


if (isMountedRef.current) {
setMod(loaded);
}
}, [isMountedRef]);

useEffect(() => {
loader();
}, [loader]);

return mod;
}
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3079,6 +3079,11 @@
"@sentry/types" "7.109.0"
"@sentry/utils" "7.109.0"

"@sentry/status-page-list@^0.0.1":
version "0.0.1"
resolved "https://registry.yarnpkg.com/@sentry/status-page-list/-/status-page-list-0.0.1.tgz#fb65dc67496067798dcd9b3285589ded63f0ecd1"
integrity sha512-LQSBWck49vqHdnt9gGKshlwtzhHLqTCAc7H1AIOF66BMmEkpsOzXjhloE7tJ8ufbuIHnPGvBseydA2CcSzwQTQ==

"@sentry/[email protected]", "@sentry/types@^7.109.0":
version "7.109.0"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.109.0.tgz#d8778358114ed05be734661cc9e1e261f4494947"
Expand Down