fix(dashboard): call route modal onClose only on route change (#12383)
This commit is contained in:
@@ -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
|
||||
|
||||
if (blockSearch) {
|
||||
const ret = isDirty && (isPathChanged || isSearchChanged)
|
||||
const shouldBlock = isDirty && (isPathChanged || isSearchChanged)
|
||||
|
||||
if (!ret) {
|
||||
if (isPathChanged) {
|
||||
onClose?.(isSubmitSuccessful)
|
||||
}
|
||||
|
||||
return ret
|
||||
return shouldBlock
|
||||
}
|
||||
|
||||
const ret = isDirty && isPathChanged
|
||||
const shouldBlock = isDirty && isPathChanged
|
||||
|
||||
if (!ret) {
|
||||
if (isPathChanged) {
|
||||
onClose?.(isSubmitSuccessful)
|
||||
}
|
||||
|
||||
return ret
|
||||
return shouldBlock
|
||||
})
|
||||
|
||||
const handleCancel = () => {
|
||||
|
||||
Reference in New Issue
Block a user