fix(dashboard): call route modal onClose only on route change (#12383)
This commit is contained in:
1 parent
9d4bc81d0f
commit
3fb4d5beb0
2 files changed
+11
-6
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(dashboard): call route modal onClose only on route change
|
||||||
+6
-6
@@ -35,22 +35,22 @@ export const RouteModalForm = <TFieldValues extends FieldValues = any>({
|
|||||||
const isSearchChanged = currentLocation.search !== nextLocation.search
|
const isSearchChanged = currentLocation.search !== nextLocation.search
|
||||||
|
|
||||||
if (blockSearch) {
|
if (blockSearch) {
|
||||||
const ret = isDirty && (isPathChanged || isSearchChanged)
|
const shouldBlock = isDirty && (isPathChanged || isSearchChanged)
|
||||||
|
|
||||||
if (!ret) {
|
if (isPathChanged) {
|
||||||
onClose?.(isSubmitSuccessful)
|
onClose?.(isSubmitSuccessful)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret
|
return shouldBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
const ret = isDirty && isPathChanged
|
const shouldBlock = isDirty && isPathChanged
|
||||||
|
|
||||||
if (!ret) {
|
if (isPathChanged) {
|
||||||
onClose?.(isSubmitSuccessful)
|
onClose?.(isSubmitSuccessful)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret
|
return shouldBlock
|
||||||
})
|
})
|
||||||
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
|
|||||||
Reference in new issue
Block a user