fix(dashboard): call route modal onClose only on route change (#12383)

This commit is contained in:
Frane Polić
2025-05-11 19:52:12 +02:00
committed by GitHub
parent 9d4bc81d0f
commit 3fb4d5beb0
2 changed files with 11 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): call route modal onClose only on route change
@@ -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 = () => {