Skip to content

Commit

Permalink
fix: Reset values on asset category change (#405)
Browse files Browse the repository at this point in the history
* fix: Remove tooltip as soon as mouse is hovered away

* fix: Reset values on Asset Category Change
  • Loading branch information
getwithashish authored Jul 22, 2024
1 parent e792659 commit 5ebeef4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
22 changes: 19 additions & 3 deletions exam_frontend/src/components/AddAsset/AddAsset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,25 @@ const AddAsset: React.FC = ({
}
};
const handleResetForm = () => {
setFormData({}); // Clear the form data
setResetForm(true); // Trigger reset
setFormData({});
setResetForm(true);
setassettypeValue("");
setValue("");
setLicenseValue("");
setOwnerValue("");
setAssetLocation("");
setAssetBu("");
setModelNumber("");
setOs("");
setOsVersion("");
setMobileOs("");
setProcessor("");
setProcessorGen("");
setMemory("");
setStorage("");

setTimeout(() => {
setResetForm(false); // Reset the trigger after a short delay
setResetForm(false);
}, 100);
};

Expand Down Expand Up @@ -472,6 +487,7 @@ const AddAsset: React.FC = ({
displayEmpty
onChange={(event) => {
setAssetCategoryValue(event.target.value as string);
handleResetForm();
setFormData({
...formData,
asset_category: event.target.value as string,
Expand Down
1 change: 1 addition & 0 deletions exam_frontend/src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ToolTip: React.FC<TooltipProps> = ({ title, children }) => (
title={title}
placement="top"
TransitionComponent={Zoom}
disableInteractive
>
{children}
</Tooltip>
Expand Down

0 comments on commit 5ebeef4

Please sign in to comment.