-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ref(getting-started-docs): Source sdks version from sentry release re…
…gistry (#54675)
- Loading branch information
1 parent
3db3d99
commit d5615b9
Showing
75 changed files
with
844 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
static/app/components/onboarding/gettingStartedDoc/useSourcePackageRegistries.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import {useEffect} from 'react'; | ||
|
||
import {Client} from 'sentry/api'; | ||
import {handleXhrErrorResponse} from 'sentry/utils/handleXhrErrorResponse'; | ||
import {useApiQuery} from 'sentry/utils/queryClient'; | ||
|
||
type ReleaseRegistrySdk = Record< | ||
string, | ||
{ | ||
canonical: string; | ||
main_docs_url: string; | ||
name: string; | ||
package_url: string; | ||
repo_url: string; | ||
version: string; | ||
} | ||
>; | ||
|
||
// This exists because /extensions/type/search API is not prefixed with | ||
// /api/0/, but the default API client on the abstract issue form is... | ||
const API_CLIENT = new Client({baseUrl: '', headers: {}, credentials: 'omit'}); | ||
|
||
/** | ||
* Fetches the release registry list for SDKs | ||
*/ | ||
export function useSourcePackageRegistries() { | ||
const releaseRegistrySdk = useApiQuery<ReleaseRegistrySdk>( | ||
['https://release-registry.services.sentry.io/sdks'], | ||
{ | ||
staleTime: Infinity, | ||
}, | ||
API_CLIENT | ||
); | ||
|
||
useEffect(() => { | ||
if (releaseRegistrySdk.error) { | ||
handleXhrErrorResponse( | ||
'Failed to fetch sentry release registry', | ||
releaseRegistrySdk.error | ||
); | ||
} | ||
}, [releaseRegistrySdk.error]); | ||
|
||
return releaseRegistrySdk; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.