Skip to content

Commit

Permalink
fix(app): removed infinite loop glitch triggered by a failed get scor…
Browse files Browse the repository at this point in the history
…e request (passportxyz#2131)
  • Loading branch information
lucianHymer authored Feb 2, 2024
1 parent d983d4f commit 7424858
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions app/context/scorerContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ export const ScorerContextProvider = ({ children }: { children: any }) => {
const numThreshold = Number.parseFloat(response.data.evidence.threshold);
const numScore = Number.parseFloat(response.data.score);

if (needsRescore(rescore, numRawScore, response.data.stamp_scores))
return loadScore(address, dbAccessToken, true);

setRawScore(numRawScore);
setThreshold(numThreshold);
setScore(numScore);
Expand All @@ -123,16 +120,6 @@ export const ScorerContextProvider = ({ children }: { children: any }) => {
}
};

const needsRescore = (currentlyRescoring: boolean, rawScore: number, stamp_scores: any): boolean => {
let needsRescore = rawScore > 0;
if (!currentlyRescoring && needsRescore) {
try {
if (Object.keys(stamp_scores).length > 0) needsRescore = false;
} catch {}
}
return needsRescore;
};

const fetchStampWeights = async () => {
try {
const response = await axios.get(`${scorerApiGetWeights}`);
Expand Down

0 comments on commit 7424858

Please sign in to comment.