Skip to content

Commit

Permalink
fix: prevent permanent error state
Browse files Browse the repository at this point in the history
  • Loading branch information
PupoSDC committed Feb 6, 2024
1 parent 798256d commit 8d66cf0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,17 @@ export abstract class QuestionBankSearchProvider<
if (thisWork) return await thisWork;

const newWork = (async () => {
const searchDocuments = await this.getSearchDocuments(bank);
const firstId = searchDocuments[0]?.id;
if (!firstId || this.searchIndex.has(firstId)) return;
await this.searchIndex.addAll(searchDocuments);
try {
const searchDocuments = await this.getSearchDocuments(bank);
const firstId = searchDocuments[0]?.id;
if (!firstId || this.searchIndex.has(firstId)) return;
await this.searchIndex.addAllAsync(searchDocuments);
} catch (e) {
console.error("Error indexing the question Bank", e);
this.initializeSearchIndex(bank);
}
})();

this.initializationWork.set(bank, newWork);
await newWork;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export const AnnexSearchItem: FunctionComponent<{
</Link>
))}
<Typography level="h5" sx={{ fontSize: 14 }}>
Learning OBjectives
Learning Objectives
</Typography>
{result.learningObjectives.map(({ href, id }) => (
<Link href={href} key={id} sx={{ fontSize: "xs", pr: 1 }}>
Expand Down

0 comments on commit 8d66cf0

Please sign in to comment.