Skip to content

Commit

Permalink
fix: add some missing hooks dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
irudoy committed Oct 6, 2020
1 parent ab0b993 commit 839c5e5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/gallery-custom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const CustomGallery: FC<CustomGalleryProps> = ({
}
}
},
[],
[options, galleryUID, onOpen],
)

useEffect(() => {
Expand Down Expand Up @@ -138,7 +138,7 @@ export const CustomGallery: FC<CustomGalleryProps> = ({
if (pid && gid === String(galleryUID)) {
open(null, pid)
}
}, [])
}, [open, galleryUID])

const remove = useCallback((ref) => {
items.current.delete(ref)
Expand All @@ -148,9 +148,12 @@ export const CustomGallery: FC<CustomGalleryProps> = ({
items.current.set(ref, data)
}, [])

const openAt = useCallback((index: number) => {
open(null, null, index)
}, [])
const openAt = useCallback(
(index: number) => {
open(null, null, index)
},
[open],
)

return (
<Context.Provider value={{ remove, set, handleClick: open, open: openAt }}>
Expand Down

0 comments on commit 839c5e5

Please sign in to comment.