Skip to content

Commit

Permalink
code review: clear timeout when component unmounts
Browse files Browse the repository at this point in the history
  • Loading branch information
aversini committed Dec 2, 2023
1 parent f216550 commit ee6e072
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useRef, useState } from "react";
import React, { useEffect, useRef, useState } from "react";

import { mergeRefs } from "../../common/utilities";
import { ButtonIcon, IconHide, IconShow, TextInput } from "..";
Expand Down Expand Up @@ -113,6 +113,12 @@ export const TextInputMask = React.forwardRef<
onChange && onChange(e);
};

useEffect(() => {
return () => {
clearTimeout(automaskTimerRef.current);
};
}, []);

/**
* TextInputMask rules.
*
Expand Down

0 comments on commit ee6e072

Please sign in to comment.