feat(admin-ui, medusa-react): product page categories management + nested multiselect (#3401)
* chore: allow products to be categorized in product create/edit page * refactor: cleanup * feat: invalidate product details cache when categories change * fix: update changesets * fix: push ner changeset * feat: limit popup height --------- Co-authored-by: fPolic <frane@medusajs.com> Co-authored-by: Oliver Windall Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect } from "react"
|
||||
|
||||
const useOutsideClick = (callback: () => void, ref: any) => {
|
||||
const useOutsideClick = (callback: () => void, ref: any, capture = false) => {
|
||||
useEffect(() => {
|
||||
const handleClickOutside = (e) => {
|
||||
if (!ref.current.contains(e.target)) {
|
||||
@@ -8,12 +8,12 @@ const useOutsideClick = (callback: () => void, ref: any) => {
|
||||
}
|
||||
}
|
||||
|
||||
document.addEventListener("click", handleClickOutside)
|
||||
document.addEventListener("click", handleClickOutside, capture)
|
||||
|
||||
return () => {
|
||||
document.removeEventListener("click", handleClickOutside)
|
||||
document.removeEventListener("click", handleClickOutside, capture)
|
||||
}
|
||||
}, [ref])
|
||||
}, [callback, ref, capture])
|
||||
}
|
||||
|
||||
export default useOutsideClick
|
||||
|
||||
Reference in New Issue
Block a user