Fixed project search field (#2901)

* Fixed project search field clearing

* Added CHANGELOG and incresed npm package version
main
Dmitry Kalinin 5 years ago committed by GitHub
parent 9b62b71ab1
commit 277a3bad98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -62,6 +62,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Prevented creating several issues for the same object (<https://github.com/openvinotoolkit/cvat/pull/2868>) - Prevented creating several issues for the same object (<https://github.com/openvinotoolkit/cvat/pull/2868>)
- Fixed label editor name field validator (<https://github.com/openvinotoolkit/cvat/pull/2879>) - Fixed label editor name field validator (<https://github.com/openvinotoolkit/cvat/pull/2879>)
- An error about track shapes outside of the task frames during export (<https://github.com/openvinotoolkit/cvat/pull/2890>) - An error about track shapes outside of the task frames during export (<https://github.com/openvinotoolkit/cvat/pull/2890>)
- Fixed project search field updating (<https://github.com/openvinotoolkit/cvat/pull/2901>)
### Security ### Security

@ -1,6 +1,6 @@
{ {
"name": "cvat-ui", "name": "cvat-ui",
"version": "1.15.2", "version": "1.15.3",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

@ -1,6 +1,6 @@
{ {
"name": "cvat-ui", "name": "cvat-ui",
"version": "1.15.2", "version": "1.15.3",
"description": "CVAT single-page application", "description": "CVAT single-page application",
"main": "src/index.tsx", "main": "src/index.tsx",
"scripts": { "scripts": {

@ -59,19 +59,23 @@ export default function ProjectSearchField(props: Props): JSX.Element {
}; };
useEffect(() => { useEffect(() => {
if (value && !projects.filter((project) => project.id === value).length) { if (value) {
core.projects.get({ id: value }).then((result: Project[]) => { if (!projects.filter((project) => project.id === value).length) {
const [project] = result; core.projects.get({ id: value }).then((result: Project[]) => {
setProjects([ const [project] = result;
...projects, setProjects([
{ ...projects,
id: project.id, {
name: project.name, id: project.id,
}, name: project.name,
]); },
setSearchPhrase(project.name); ]);
onSelect(project.id); setSearchPhrase(project.name);
}); onSelect(project.id);
});
}
} else {
setSearchPhrase('');
} }
}, [value]); }, [value]);

Loading…
Cancel
Save