perf: refs #8217 getDifferences fix
This commit is contained in:
parent
c7eadf2ceb
commit
342d0a6b1e
src
|
@ -111,7 +111,7 @@ const isLoading = ref(false);
|
|||
// Si elegimos observar los cambios del form significa que inicialmente las actions estaran deshabilitadas
|
||||
const isResetting = ref(false);
|
||||
const hasChanges = ref(!$props.observeFormChanges);
|
||||
const originalData = computed(() => state.get(modelValue));
|
||||
const originalData = computed(() => state.get(modelValue) ?? {});
|
||||
const formData = ref();
|
||||
const defaultButtons = computed(() => ({
|
||||
save: {
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
export default function getDifferences(initialData, formData) {
|
||||
const differences = {};
|
||||
delete initialData.$index;
|
||||
delete formData.$index;
|
||||
|
||||
if (initialData) delete initialData.$index;
|
||||
if (formData) delete formData.$index;
|
||||
for (const key in formData) {
|
||||
if (formData.hasOwnProperty(key)) {
|
||||
if (
|
||||
!initialData ||
|
||||
!initialData.hasOwnProperty(key) ||
|
||||
formData[key] !== initialData[key]
|
||||
) {
|
||||
//Añadir la diferencia solo si existe initialData
|
||||
if (!initialData.hasOwnProperty(key) || formData[key] !== initialData[key]) {
|
||||
if (initialData) {
|
||||
differences[key] = formData[key];
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue