Skip to content

Commit

Permalink
Fix send icon problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Laica-Lunasys committed Dec 27, 2020
1 parent c342481 commit e7c7775
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions frontend/dash-home/src/aircon/Aircon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,19 @@ const AirconPanel: React.FC<Props> = props => {
}

const useSendingIcon = () => {
const [sending, updateSending] = useState(false);
const [taskId, setTaskId] = useState<number>(-1);

const [sending, updateSending] = useState(false);
useEffect(() => {
setTaskId(setTimeout(() => {
updateSending(false)
}, 500));
}, [sending])

useEffect(() => {
return () => {
clearTimeout(taskId);
};
}, [taskId, sending]);
}, [taskId]);

const setSending = () => {
updateSending(true);
Expand Down

0 comments on commit e7c7775

Please sign in to comment.