From 3b56936b6bf282df89a02ba98d16fe4c23331492 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinin Date: Wed, 3 Mar 2021 17:13:28 +0300 Subject: [PATCH 1/2] Fixed project search field clearing --- .../create-task-page/project-search-field.tsx | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/cvat-ui/src/components/create-task-page/project-search-field.tsx b/cvat-ui/src/components/create-task-page/project-search-field.tsx index 450cbf953d14..9bab28e2b4fa 100644 --- a/cvat-ui/src/components/create-task-page/project-search-field.tsx +++ b/cvat-ui/src/components/create-task-page/project-search-field.tsx @@ -59,19 +59,23 @@ export default function ProjectSearchField(props: Props): JSX.Element { }; useEffect(() => { - if (value && !projects.filter((project) => project.id === value).length) { - core.projects.get({ id: value }).then((result: Project[]) => { - const [project] = result; - setProjects([ - ...projects, - { - id: project.id, - name: project.name, - }, - ]); - setSearchPhrase(project.name); - onSelect(project.id); - }); + if (value) { + if (!projects.filter((project) => project.id === value).length) { + core.projects.get({ id: value }).then((result: Project[]) => { + const [project] = result; + setProjects([ + ...projects, + { + id: project.id, + name: project.name, + }, + ]); + setSearchPhrase(project.name); + onSelect(project.id); + }); + } + } else { + setSearchPhrase(''); } }, [value]); From 7aeb2dea64998e956f1fc43488c1731355ac4d76 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinin Date: Wed, 3 Mar 2021 17:18:24 +0300 Subject: [PATCH 2/2] Added CHANGELOG and incresed npm package version --- CHANGELOG.md | 1 + cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7bb9bdc3e86c..f1b2c03a858d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 () - Fixed label editor name field validator () - An error about track shapes outside of the task frames during export () +- Fixed project search field updating () ### Security diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index a51ba06021b3..88465e0711b4 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.15.2", + "version": "1.15.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 027fffe58974..dff1015e2fc8 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.15.2", + "version": "1.15.3", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": {