Skip to content

Commit

Permalink
Unfix getDeprecatedPackageMap
Browse files Browse the repository at this point in the history
It was deemed that simply fixing the method would be too drastic
change. We want the UI to be able to reflect the deprecation status
without fully hiding mods based on deprecated dependencies, and add
support for showing various other states like "verified" while we're at
it.

Meanwhile, intentionally break the new implementation in a manner that
is easily reverted once the UI changes are ready.
  • Loading branch information
anttimaki committed Apr 12, 2024
1 parent fc6b468 commit b2fda5c
Show file tree
Hide file tree
Showing 2 changed files with 194 additions and 183 deletions.
71 changes: 39 additions & 32 deletions src/utils/Deprecations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,42 +45,49 @@ export class Deprecations {
return true;
}

for (const dependencyNameAndVersion of mod.getLatestVersion().getDependencies()) {
const dependencyName = dependencyNameAndVersion.substring(0, dependencyNameAndVersion.lastIndexOf('-'));
// TODO: it was deemed that just fixing this function would be a
// breaking change. We need to make changes to UI before the fix
// can go live. Once ready, remove the two lines below and
// uncomment the rest.
deprecationMap.set(mod.getFullName(), false);
return false;

if (currentChain.has(dependencyName)) {
continue;
}
const dependency = packageMap.get(dependencyName);
// for (const dependencyNameAndVersion of mod.getLatestVersion().getDependencies()) {
// const dependencyName = dependencyNameAndVersion.substring(0, dependencyNameAndVersion.lastIndexOf('-'));

// Package isn't available on Thunderstore, so we can't tell
// if it's deprecated or not. This will also include deps of
// packages uploaded into wrong community since the
// packageMap contains only packages from this community.
// Based on manual testing with real data, caching these to
// deprecationMap doesn't seem to improve overall performance.
if (dependency === undefined) {
continue;
}
// if (currentChain.has(dependencyName)) {
// continue;
// }
// const dependency = packageMap.get(dependencyName);

// Keep track of the dependency chain currently under
// investigation to avoid infinite recursive loops.
currentChain.add(mod.getFullName());
const dependencyDeprecated = this._populateDeprecatedPackageMapForModChain(
dependency, packageMap, deprecationMap, currentChain
);
currentChain.delete(mod.getFullName());
deprecationMap.set(dependencyName, dependencyDeprecated);
// // Package isn't available on Thunderstore, so we can't tell
// // if it's deprecated or not. This will also include deps of
// // packages uploaded into wrong community since the
// // packageMap contains only packages from this community.
// // Based on manual testing with real data, caching these to
// // deprecationMap doesn't seem to improve overall performance.
// if (dependency === undefined) {
// continue;
// }

// Eject early on the first deprecated dependency for performance.
if (dependencyDeprecated) {
deprecationMap.set(mod.getFullName(), true);
return true;
}
}
// // Keep track of the dependency chain currently under
// // investigation to avoid infinite recursive loops.
// currentChain.add(mod.getFullName());
// const dependencyDeprecated = this._populateDeprecatedPackageMapForModChain(
// dependency, packageMap, deprecationMap, currentChain
// );
// currentChain.delete(mod.getFullName());
// deprecationMap.set(dependencyName, dependencyDeprecated);

// Package is not depreceated by itself nor due to dependencies.
deprecationMap.set(mod.getFullName(), false);
return false;
// // Eject early on the first deprecated dependency for performance.
// if (dependencyDeprecated) {
// deprecationMap.set(mod.getFullName(), true);
// return true;
// }
// }

// // Package is not depreceated by itself nor due to dependencies.
// deprecationMap.set(mod.getFullName(), false);
// return false;
}
}
Loading

0 comments on commit b2fda5c

Please sign in to comment.