Skip to content

Commit

Permalink
Fix #7323: Clear timer in InputNumber component on unmount (#7325)
Browse files Browse the repository at this point in the history
* Fix #7323: Clear timer in InputNumber component on unmount

* Refactor: InputNumber use built-in `useUnmountEffect` instead of `useEffect`
  • Loading branch information
tnowad authored Oct 10, 2024
1 parent ca593ef commit f2edb0d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/lib/inputnumber/InputNumber.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react';
import PrimeReact, { PrimeReactContext } from '../api/Api';
import { useHandleStyle } from '../componentbase/ComponentBase';
import { useMergeProps, useMountEffect, useUpdateEffect } from '../hooks/Hooks';
import { useMergeProps, useMountEffect, useUnmountEffect, useUpdateEffect } from '../hooks/Hooks';
import { AngleDownIcon } from '../icons/angledown';
import { AngleUpIcon } from '../icons/angleup';
import { InputText } from '../inputtext/InputText';
Expand Down Expand Up @@ -1135,6 +1135,10 @@ export const InputNumber = React.memo(
ObjectUtils.combinedRefs(inputRef, props.inputRef);
}, [inputRef, props.inputRef]);

useUnmountEffect(() => {
clearTimer();
});

useMountEffect(() => {
constructParser();

Expand Down

0 comments on commit f2edb0d

Please sign in to comment.