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:
Riqwan Thamir
2023-03-07 19:42:01 +01:00
committed by GitHub
parent 2d2727f753
commit 47d3440766
11 changed files with 480 additions and 18 deletions

View File

@@ -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