bandade fix for dictionary update freeze - what on earth happened here

This commit is contained in:
adueck 2022-10-29 22:47:51 +05:00
parent 1fef1cd8af
commit 4347510403
2 changed files with 6 additions and 5 deletions

View File

@ -345,16 +345,18 @@ class App extends Component<RouteComponentProps, State> {
} }
private handleDictionaryUpdate() { private handleDictionaryUpdate() {
// TODO: fix - what the heck happened and what's going on here
dictionary.update(() => { dictionary.update(() => {
this.setState({ dictionaryStatus: "updating" }); // this.setState({ dictionaryStatus: "updating" });
}).then(({ dictionaryInfo }) => { }).then(({ dictionaryInfo }) => {
if (this.state.dictionaryInfo?.release !== dictionaryInfo?.release) { console.log({ dictionaryInfo, old: this.state.dictionaryInfo })
//if (this.state.dictionaryInfo?.release !== dictionaryInfo?.release) {
// to avoid unnecessary re-rendering that breaks things // to avoid unnecessary re-rendering that breaks things
this.setState({ this.setState({
dictionaryStatus: "ready", dictionaryStatus: "ready",
dictionaryInfo, dictionaryInfo,
}); });
} //}
}).catch(() => { }).catch(() => {
this.setState({ dictionaryStatus: "error loading" }); this.setState({ dictionaryStatus: "error loading" });
}); });
@ -439,7 +441,7 @@ class App extends Component<RouteComponentProps, State> {
// TODO: right now not checking user very often cause it messes with the state? // TODO: right now not checking user very often cause it messes with the state?
// causes the verb quizzer to reset? // causes the verb quizzer to reset?
private cronJob = new CronJob("* * * * *", () => { private cronJob = new CronJob("1/10 * * * *", () => {
this.handleDictionaryUpdate(); this.handleDictionaryUpdate();
this.handleLoadUser(); this.handleLoadUser();
}) })

View File

@ -287,7 +287,6 @@ function pashtoFuzzyLookup<S extends T.DictionaryEntry>({ searchString, page, tp
.find(slightlyFuzzyQuery) .find(slightlyFuzzyQuery)
.limit(slightlyFuzzyResultsLimit) .limit(slightlyFuzzyResultsLimit)
.data(); .data();
console.log({ slightlyFuzzyResults });
resultsGiven.push(...slightlyFuzzyResults.map((mpd: any) => mpd.$loki)); resultsGiven.push(...slightlyFuzzyResults.map((mpd: any) => mpd.$loki));
// Get fuzzy matches // Get fuzzy matches
const pashtoRegExLogic = fuzzifyPashto(search, { const pashtoRegExLogic = fuzzifyPashto(search, {