mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-04 18:53:26 +08:00
fix(commandline): languages sometimes didnt load in time, showing an error
This commit is contained in:
parent
e551e043af
commit
c0500ce9c6
2 changed files with 14 additions and 3 deletions
|
@ -9,6 +9,7 @@ import * as Notifications from "../elements/notifications";
|
|||
import * as OutOfFocus from "../test/out-of-focus";
|
||||
import * as ActivePage from "../states/active-page";
|
||||
import { focusWords } from "../test/test-ui";
|
||||
import * as Loader from "../elements/loader";
|
||||
|
||||
type CommandlineMode = "search" | "input";
|
||||
type InputModeParams = {
|
||||
|
@ -77,9 +78,11 @@ export function show(
|
|||
settings.subgroupOverride
|
||||
);
|
||||
if (exists) {
|
||||
subgroupOverride = CommandlineLists.getList(
|
||||
Loader.show();
|
||||
subgroupOverride = await CommandlineLists.getList(
|
||||
settings.subgroupOverride as CommandlineLists.ListsObjectKeys
|
||||
);
|
||||
Loader.hide();
|
||||
} else {
|
||||
subgroupOverride = null;
|
||||
usingSingleList = Config.singleListCommandLine === "on";
|
||||
|
|
|
@ -501,9 +501,17 @@ export function doesListExist(listName: string): boolean {
|
|||
return lists[listName as ListsObjectKeys] !== undefined;
|
||||
}
|
||||
|
||||
export function getList(
|
||||
export async function getList(
|
||||
listName: ListsObjectKeys
|
||||
): MonkeyTypes.CommandsSubgroup {
|
||||
): Promise<MonkeyTypes.CommandsSubgroup> {
|
||||
await Promise.allSettled([
|
||||
layoutsPromise,
|
||||
languagesPromise,
|
||||
funboxPromise,
|
||||
fontsPromise,
|
||||
themesPromise,
|
||||
challengesPromise,
|
||||
]);
|
||||
const list = lists[listName];
|
||||
if (!list) {
|
||||
Notifications.add(`List not found: ${listName}`, -1);
|
||||
|
|
Loading…
Reference in a new issue