From a206f731897751a4f07dffe4dc65116d2d7a454a Mon Sep 17 00:00:00 2001 From: Maya Date: Wed, 15 Sep 2021 21:35:54 +0300 Subject: [PATCH] Fix uploading annotation --- .../annotation-page/top-bar/annotation-menu.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx index 9f2d8030706d..f48cdc4101bb 100644 --- a/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx +++ b/cvat-ui/src/components/annotation-page/top-bar/annotation-menu.tsx @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: MIT -import React from 'react'; +import React, { useState } from 'react'; import Menu from 'antd/lib/menu'; import Modal from 'antd/lib/modal'; // eslint-disable-next-line import/no-extraneous-dependencies @@ -48,14 +48,13 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { const jobStatus = jobInstance.status; const taskID = jobInstance.task.id; - let latestParams: MenuInfo | null = null; + const [latestParams, setLatestParams] = useState(null); function onClickMenuWrapper(params: MenuInfo | null, file?: File): void { const copyParams = params || latestParams; if (!copyParams) { return; } - latestParams = params; - + setLatestParams(params); function checkUnsavedChanges(_copyParams: MenuInfo): void { if (jobInstance.annotations.hasUnsavedChanges()) { Modal.confirm({ @@ -153,7 +152,7 @@ export default function AnnotationMenuComponent(props: Props): JSX.Element { const is2d = jobInstance.task.dimension === DimensionType.DIM_2D; return ( - + onClickMenuWrapper(info as MenuInfo)} className='cvat-annotation-menu' selectable={false}> {LoadSubmenu({ loaders, loadActivity,