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