mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
ui: problemconfig: fix extra_files autocomplete
This commit is contained in:
2 files changed
+7
-3
No files matched your search
@@ -128,9 +128,12 @@ const AutoComplete = forwardRef(function Impl<T>(props: AutoCompleteProps<T>, re
|
|||||||
setCurrentItem((!freeSolo && queryCache[query].length > 0) ? 0 : null);
|
setCurrentItem((!freeSolo && queryCache[query].length > 0) ? 0 : null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setSelectedKeys(props.selectedKeys || []);
|
||||||
|
}, [JSON.stringify(props.selectedKeys)]);
|
||||||
const dispatchChange = () => {
|
const dispatchChange = () => {
|
||||||
if (!multi) onChange(inputRef.current?.value);
|
if (!multi) onChange(inputRef.current?.value);
|
||||||
else onChange([...selectedKeys, inputRef.current?.value].filter((v) => v?.trim().length > 0).join(','));
|
else onChange(selectedKeys.filter((v) => v?.trim().length > 0).join(','));
|
||||||
};
|
};
|
||||||
|
|
||||||
let first = !multi;
|
let first = !multi;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Card, InputGroup, Tag,
|
Card, InputGroup, Tag,
|
||||||
} from '@blueprintjs/core';
|
} from '@blueprintjs/core';
|
||||||
|
import { isEqual } from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
import { i18n } from 'vj/utils';
|
import { i18n } from 'vj/utils';
|
||||||
@@ -35,8 +36,8 @@ function FileIOConfig() {
|
|||||||
|
|
||||||
function ExtraFilesConfig() {
|
function ExtraFilesConfig() {
|
||||||
const Files = useSelector((state: RootState) => state.testdata);
|
const Files = useSelector((state: RootState) => state.testdata);
|
||||||
const userExtraFiles = useSelector((state: RootState) => state.config.user_extra_files) || [];
|
const userExtraFiles = useSelector((state: RootState) => state.config.user_extra_files || [], isEqual);
|
||||||
const judgeExtraFiles = useSelector((state: RootState) => state.config.judge_extra_files) || [];
|
const judgeExtraFiles = useSelector((state: RootState) => state.config.judge_extra_files || [], isEqual);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const userRef = React.useRef<any>();
|
const userRef = React.useRef<any>();
|
||||||
const judgeRef = React.useRef<any>();
|
const judgeRef = React.useRef<any>();
|
||||||
|
|||||||
Reference in new issue
Block a user