mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core&ui: cache uicontext.domain
This commit is contained in:
1 parent
43fb00e3c7
commit
e39a5fa87f
8 files changed
+71
-10
No files matched your search
@@ -3,7 +3,9 @@ import ProblemSelectAutoComplete from 'vj/components/autocomplete/ProblemSelectA
|
||||
import UserSelectAutoComplete from 'vj/components/autocomplete/UserSelectAutoComplete';
|
||||
import Notification from 'vj/components/notification';
|
||||
import { NamedPage } from 'vj/misc/Page';
|
||||
import { getAvailableLangs, request, tpl } from 'vj/utils';
|
||||
import {
|
||||
getAvailableLangs, getDomainInfo, request, tpl,
|
||||
} from 'vj/utils';
|
||||
|
||||
const page = new NamedPage('record_main', async () => {
|
||||
const [{ default: WebSocket }, { DiffDOM }] = await Promise.all([
|
||||
@@ -37,7 +39,8 @@ const page = new NamedPage('record_main', async () => {
|
||||
ProblemSelectAutoComplete.getOrConstruct($('[name="pid"]'), {
|
||||
clearDefaultValue: false,
|
||||
});
|
||||
const langs = UiContext.domain.langs?.split(',').map((i) => i.trim()).filter((i) => i);
|
||||
const domain = await getDomainInfo();
|
||||
const langs = domain.langs?.split(',').map((i) => i.trim()).filter((i) => i);
|
||||
const availableLangs = getAvailableLangs(langs?.length ? langs : undefined);
|
||||
Object.keys(availableLangs).map(
|
||||
(i) => ($('select[name="lang"]').append(tpl`<option value="${i}" key="${i}">${availableLangs[i].display}</option>`)));
|
||||
|
||||
Reference in new issue
Block a user