Skip to content

Commit

Permalink
Move constant out of functional component
Browse files Browse the repository at this point in the history
  • Loading branch information
WithoutPants committed Nov 2, 2024
1 parent ecd00a3 commit 8cde73f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ui/v2.5/src/components/Shared/DurationInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ interface IProps {
allowNegative?: boolean;
}

const includeMS = true;

export const DurationInput: React.FC<IProps> = ({
disabled,
value,
Expand All @@ -29,7 +31,6 @@ export const DurationInput: React.FC<IProps> = ({
error,
allowNegative = false,
}) => {
const includeMS = true;
const [tmpValue, setTmpValue] = useState<string>();

function onChange(e: React.ChangeEvent<HTMLInputElement>) {
Expand Down Expand Up @@ -103,7 +104,7 @@ export const DurationInput: React.FC<IProps> = ({
} else if (value !== null && value !== undefined) {
return TextUtils.secondsToTimestamp(value, includeMS);
}
}, [value, tmpValue, includeMS]);
}, [value, tmpValue]);

const format = "hh:mm:ss.ms";

Expand Down

0 comments on commit 8cde73f

Please sign in to comment.