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