Skip to content

Commit

Permalink
🐛 Fix(tenant): DataCloneError in FinancialDocument (MTES-MCT#1584)
Browse files Browse the repository at this point in the history
structuredClone does not work on proxy object, need to use toRaw
  • Loading branch information
poissoj authored Nov 20, 2024
1 parent 7a2f006 commit 34adb7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ import { DocumentDeniedReasons } from 'df-shared-next/src/models/DocumentDeniedR
import { UtilsService } from '../../../services/UtilsService'
import SimpleRadioButtons from 'df-shared-next/src/Button/SimpleRadioButtons.vue'
import useTenantStore from '../../../stores/tenant-store'
import { computed, onBeforeMount, ref } from 'vue'
import { computed, onBeforeMount, ref, toRaw } from 'vue'
import { useI18n } from 'vue-i18n'
import { ToastService } from '../../../services/ToastService'
import { useLoading } from 'vue-loading-overlay'
Expand Down Expand Up @@ -224,7 +224,7 @@ const isNoIncomeAndFiles = ref(false)
onBeforeMount(() => {
if (guarantorFinancialDocumentSelected.value) {
financialDocument.value = {
...structuredClone(guarantorFinancialDocumentSelected.value)
...structuredClone(toRaw(guarantorFinancialDocumentSelected.value))
}
}
const doc = guarantorFinancialDocument()
Expand Down Expand Up @@ -392,7 +392,7 @@ async function save(): Promise<boolean> {
.saveGuarantorFinancial(formData)
.then(() => {
if (guarantorFinancialDocumentSelected.value) {
financialDocument.value = structuredClone(guarantorFinancialDocumentSelected.value)
financialDocument.value = structuredClone(toRaw(guarantorFinancialDocumentSelected.value))
}
ToastService.saveSuccess()
return Promise.resolve(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ import { UtilsService } from '@/services/UtilsService'
import SimpleRadioButtons from 'df-shared-next/src/Button/SimpleRadioButtons.vue'
import { useI18n } from 'vue-i18n'
import useTenantStore from '@/stores/tenant-store'
import { computed, onBeforeMount, ref } from 'vue'
import { computed, onBeforeMount, ref, toRaw } from 'vue'
import { ToastService } from '@/services/ToastService'
import { useLoading } from 'vue-loading-overlay'
import { Form, Field, ErrorMessage } from 'vee-validate'
Expand All @@ -258,7 +258,7 @@ const isNoIncomeAndFiles = ref(false)
const financialDocument = ref(new FinancialDocument())
onBeforeMount(() => {
financialDocument.value = { ...structuredClone(financialDocumentSelected.value) }
financialDocument.value = { ...structuredClone(toRaw(financialDocumentSelected.value)) }
const doc = tenantFinancialDocument()
if (doc?.documentDeniedReasons) {
const deniedReasons = tenantFinancialDocument()?.documentDeniedReasons
Expand Down Expand Up @@ -441,7 +441,7 @@ async function save(): Promise<boolean> {
.saveTenantFinancial(formData)
.then(() => {
financialDocument.value = {
...structuredClone(financialDocumentSelected.value)
...structuredClone(toRaw(financialDocumentSelected.value))
}
ToastService.saveSuccess()
return Promise.resolve(true)
Expand Down

0 comments on commit 34adb7f

Please sign in to comment.