fix hooks deps
This commit is contained in:
parent
7c144b3e14
commit
999167e11e
|
|
@ -74,7 +74,6 @@ const Modal = React.forwardRef<HTMLDivElement, ModalOptions & Props>(
|
|||
|
||||
useEffect(() => {
|
||||
const onHide = () => {
|
||||
/* istanbul ignore else */
|
||||
if (!hidden) {
|
||||
dismiss()
|
||||
}
|
||||
|
|
@ -87,7 +86,7 @@ const Modal = React.forwardRef<HTMLDivElement, ModalOptions & Props>(
|
|||
return () => {
|
||||
el.off('hide.bs.modal', onHide).off('hidden.bs.modal', onHidden)
|
||||
}
|
||||
}, [])
|
||||
}, [hidden, props.onDismiss])
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ const InfoBox: React.FC<Props> = props => {
|
|||
props.onDisable(plugin)
|
||||
}
|
||||
},
|
||||
[],
|
||||
[plugin],
|
||||
)
|
||||
|
||||
const handleDelete = useCallback(() => {
|
||||
props.onDelete(plugin)
|
||||
}, [])
|
||||
}, [plugin])
|
||||
|
||||
return (
|
||||
<div className={`info-box mr-3 ${styles.box}`}>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,14 @@ test('forward ref', () => {
|
|||
|
||||
test('jQuery events', () => {
|
||||
const ref = React.createRef<HTMLDivElement>()
|
||||
render(<Modal ref={ref} show />)
|
||||
const { getByText } = render(<Modal ref={ref} mode="confirm" show />)
|
||||
act(() => {
|
||||
$(ref.current!)
|
||||
.trigger('hide.bs.modal')
|
||||
.trigger('hidden.bs.modal')
|
||||
})
|
||||
|
||||
fireEvent.click(getByText(trans('general.cancel')))
|
||||
act(() => {
|
||||
$(ref.current!)
|
||||
.trigger('hide.bs.modal')
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user