Merge pull request #761 from shariquerik/data-tab-dirty-fix

This commit is contained in:
Shariq Ansari 2025-04-21 11:53:36 +05:30 committed by GitHub
commit a7955ba9c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 27 additions and 3 deletions

View File

@ -64,7 +64,7 @@ import LoadingIndicator from '@/components/Icons/LoadingIndicator.vue'
import { createToast } from '@/utils'
import { usersStore } from '@/stores/users'
import { isMobileView } from '@/composables/settings'
import { ref } from 'vue'
import { ref, watch } from 'vue'
const props = defineProps({
doctype: {
@ -114,4 +114,20 @@ const tabs = createResource({
function saveChanges() {
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>

View File

@ -267,7 +267,11 @@
</div>
</Resizer>
</div>
<ErrorPage v-else :errorTitle="errorTitle" :errorMessage="errorMessage" />
<ErrorPage
v-else-if="errorTitle"
:errorTitle="errorTitle"
:errorMessage="errorMessage"
/>
<OrganizationModal
v-model="showOrganizationModal"
v-model:organization="_organization"

View File

@ -191,7 +191,11 @@
</div>
</Resizer>
</div>
<ErrorPage v-else :errorTitle="errorTitle" :errorMessage="errorMessage" />
<ErrorPage
v-else-if="errorTitle"
:errorTitle="errorTitle"
:errorMessage="errorMessage"
/>
<Dialog
v-model="showConvertToDealModal"
:options="{