Skip to content
Merged
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
17 changes: 12 additions & 5 deletions src/r2mm/ecosystem/EcosystemSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,18 @@ export async function updateLatestEcosystemSchema(): Promise<void> {
const currentSchema = await loadSavedEcosystemSchema();
const result = await fetchLatestSchema(currentSchema);

const updateIcons = async (mergedSchema: ThunderstoreEcosystem): Promise<void> => {
const nonBundledIconUrls = getNonBundledIconUrls(mergedSchema, bundledSchema);
if (nonBundledIconUrls.length > 0) {
void GameImageProvider.prefetchAll(nonBundledIconUrls);
}
}

if (result.kind === "not-modified") {
return updateEcosystemReactives();
const mergedSchema = await resolveCachedEcosystemSchema();
await updateIcons(mergedSchema);
await internalUpdateEcosystemReactives(mergedSchema);
return;
}

if (result.kind === "failed") {
Expand All @@ -186,10 +196,7 @@ export async function updateLatestEcosystemSchema(): Promise<void> {
const mergedSchema = mergeSchemas(bundledSchema, result.schema);
await writeLatestEcosystemSchema(mergedSchema, result.lastModified);
await internalUpdateEcosystemReactives(mergedSchema);
const nonBundledIconUrls = getNonBundledIconUrls(mergedSchema, bundledSchema);
if (nonBundledIconUrls.length > 0) {
void GameImageProvider.prefetchAll(nonBundledIconUrls);
}
await updateIcons(mergedSchema);
}

async function writeLatestEcosystemSchema(
Expand Down
Loading