Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/content/github/common/fetchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function getFlags(metadata: FileMetadata): Promise<string[]> {
referrer: window.location.href,
});

const flags = response.ok ? response.data.results : [];
const flags = Array.isArray(response.data?.results) ? response.data.results : [];

return flags.map((f: any) => f.flag_name);
}
Expand All @@ -35,7 +35,7 @@ export async function getComponents(metadata: FileMetadata): Promise<string[]> {
referrer: window.location.href,
});

const components = response.ok ? response.data : [];
const components = Array.isArray(response.data) ? response.data : [];

return components.map((c: any) => c.component_id);
}
Expand Down
8 changes: 6 additions & 2 deletions src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ export class Codecov {
});
const data = await response.json();

await this.setCached("flags", owner, repo, data);
if (response.ok) {
await this.setCached("flags", owner, repo, data);
}

return {
ok: response.ok,
Expand Down Expand Up @@ -246,7 +248,9 @@ export class Codecov {
});
const data = await response.json();

await this.setCached("components", owner, repo, data);
if (response.ok) {
await this.setCached("components", owner, repo, data);
}

return {
ok: response.ok,
Expand Down
Loading