|
@@ -19,7 +19,7 @@ import parseLinkHeader from 'sentry/utils/parseLinkHeader';
|
|
async function fetchOrg(
|
|
async function fetchOrg(
|
|
api: Client,
|
|
api: Client,
|
|
slug: string,
|
|
slug: string,
|
|
- isInitialFetch?: boolean
|
|
|
|
|
|
+ usePreload?: boolean
|
|
): Promise<Organization> {
|
|
): Promise<Organization> {
|
|
const [org] = await getPreloadedDataPromise(
|
|
const [org] = await getPreloadedDataPromise(
|
|
'organization',
|
|
'organization',
|
|
@@ -31,7 +31,7 @@ async function fetchOrg(
|
|
includeAllArgs: true,
|
|
includeAllArgs: true,
|
|
query: {detailed: 0},
|
|
query: {detailed: 0},
|
|
}),
|
|
}),
|
|
- isInitialFetch
|
|
|
|
|
|
+ usePreload
|
|
);
|
|
);
|
|
|
|
|
|
if (!org) {
|
|
if (!org) {
|
|
@@ -53,7 +53,7 @@ async function fetchOrg(
|
|
|
|
|
|
async function fetchProjectsAndTeams(
|
|
async function fetchProjectsAndTeams(
|
|
slug: string,
|
|
slug: string,
|
|
- isInitialFetch?: boolean
|
|
|
|
|
|
+ usePreload?: boolean
|
|
): Promise<
|
|
): Promise<
|
|
[
|
|
[
|
|
[Project[], string | undefined, XMLHttpRequest | ResponseMeta | undefined],
|
|
[Project[], string | undefined, XMLHttpRequest | ResponseMeta | undefined],
|
|
@@ -76,7 +76,7 @@ async function fetchProjectsAndTeams(
|
|
collapse: 'latestDeploys',
|
|
collapse: 'latestDeploys',
|
|
},
|
|
},
|
|
}),
|
|
}),
|
|
- isInitialFetch
|
|
|
|
|
|
+ usePreload
|
|
);
|
|
);
|
|
|
|
|
|
const teamsPromise = getPreloadedDataPromise(
|
|
const teamsPromise = getPreloadedDataPromise(
|
|
@@ -88,7 +88,7 @@ async function fetchProjectsAndTeams(
|
|
uncancelableApi.requestPromise(`/organizations/${slug}/teams/`, {
|
|
uncancelableApi.requestPromise(`/organizations/${slug}/teams/`, {
|
|
includeAllArgs: true,
|
|
includeAllArgs: true,
|
|
}),
|
|
}),
|
|
- isInitialFetch
|
|
|
|
|
|
+ usePreload
|
|
);
|
|
);
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -117,12 +117,13 @@ async function fetchProjectsAndTeams(
|
|
* @param slug The organization slug
|
|
* @param slug The organization slug
|
|
* @param silent Should we silently update the organization (do not clear the
|
|
* @param silent Should we silently update the organization (do not clear the
|
|
* current organization in the store)
|
|
* current organization in the store)
|
|
|
|
+ * @param usePreload Should the preloaded data be used if available?
|
|
*/
|
|
*/
|
|
export function fetchOrganizationDetails(
|
|
export function fetchOrganizationDetails(
|
|
api: Client,
|
|
api: Client,
|
|
slug: string,
|
|
slug: string,
|
|
silent: boolean,
|
|
silent: boolean,
|
|
- isInitialFetch?: boolean
|
|
|
|
|
|
+ usePreload?: boolean
|
|
) {
|
|
) {
|
|
if (!silent) {
|
|
if (!silent) {
|
|
OrganizationStore.reset();
|
|
OrganizationStore.reset();
|
|
@@ -133,7 +134,7 @@ export function fetchOrganizationDetails(
|
|
|
|
|
|
const loadOrganization = async () => {
|
|
const loadOrganization = async () => {
|
|
try {
|
|
try {
|
|
- await fetchOrg(api, slug, isInitialFetch);
|
|
|
|
|
|
+ await fetchOrg(api, slug, usePreload);
|
|
} catch (err) {
|
|
} catch (err) {
|
|
if (!err) {
|
|
if (!err) {
|
|
return;
|
|
return;
|
|
@@ -161,10 +162,7 @@ export function fetchOrganizationDetails(
|
|
};
|
|
};
|
|
|
|
|
|
const loadTeamsAndProjects = async () => {
|
|
const loadTeamsAndProjects = async () => {
|
|
- const [[projects], [teams, , resp]] = await fetchProjectsAndTeams(
|
|
|
|
- slug,
|
|
|
|
- isInitialFetch
|
|
|
|
- );
|
|
|
|
|
|
+ const [[projects], [teams, , resp]] = await fetchProjectsAndTeams(slug, usePreload);
|
|
|
|
|
|
ProjectsStore.loadInitialData(projects ?? []);
|
|
ProjectsStore.loadInitialData(projects ?? []);
|
|
|
|
|