Merge pull request #762 from frappe/mergify/bp/main-hotfix/pr-761
fix: mark data tab form dirty by watching field updates (backport #761)
This commit is contained in:
commit
b4e6db3e5b
@ -64,7 +64,7 @@ import LoadingIndicator from '@/components/Icons/LoadingIndicator.vue'
|
|||||||
import { createToast } from '@/utils'
|
import { createToast } from '@/utils'
|
||||||
import { usersStore } from '@/stores/users'
|
import { usersStore } from '@/stores/users'
|
||||||
import { isMobileView } from '@/composables/settings'
|
import { isMobileView } from '@/composables/settings'
|
||||||
import { ref } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
doctype: {
|
doctype: {
|
||||||
@ -114,4 +114,20 @@ const tabs = createResource({
|
|||||||
function saveChanges() {
|
function saveChanges() {
|
||||||
data.save.submit()
|
data.save.submit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => data.doc,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
if (!oldValue) return
|
||||||
|
if (newValue && oldValue) {
|
||||||
|
const isDirty =
|
||||||
|
JSON.stringify(newValue) !== JSON.stringify(data.originalDoc)
|
||||||
|
data.isDirty = isDirty
|
||||||
|
if (isDirty) {
|
||||||
|
data.save.loading = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ deep: true },
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -267,7 +267,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</Resizer>
|
</Resizer>
|
||||||
</div>
|
</div>
|
||||||
<ErrorPage v-else :errorTitle="errorTitle" :errorMessage="errorMessage" />
|
<ErrorPage
|
||||||
|
v-else-if="errorTitle"
|
||||||
|
:errorTitle="errorTitle"
|
||||||
|
:errorMessage="errorMessage"
|
||||||
|
/>
|
||||||
<OrganizationModal
|
<OrganizationModal
|
||||||
v-model="showOrganizationModal"
|
v-model="showOrganizationModal"
|
||||||
v-model:organization="_organization"
|
v-model:organization="_organization"
|
||||||
|
|||||||
@ -191,7 +191,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</Resizer>
|
</Resizer>
|
||||||
</div>
|
</div>
|
||||||
<ErrorPage v-else :errorTitle="errorTitle" :errorMessage="errorMessage" />
|
<ErrorPage
|
||||||
|
v-else-if="errorTitle"
|
||||||
|
:errorTitle="errorTitle"
|
||||||
|
:errorMessage="errorMessage"
|
||||||
|
/>
|
||||||
<Dialog
|
<Dialog
|
||||||
v-model="showConvertToDealModal"
|
v-model="showConvertToDealModal"
|
||||||
:options="{
|
:options="{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user