@open-mercato/ui 0.6.5-develop.4674.1.bf258550ce → 0.6.5-develop.4691.1.bb409545b3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/backend/CrudForm.js
CHANGED
|
@@ -1754,7 +1754,10 @@ function CrudForm({
|
|
|
1754
1754
|
appliedInitialValuesSnapshotRef.current = snapshot;
|
|
1755
1755
|
const initialRecord = initialValues;
|
|
1756
1756
|
let mergedValues = null;
|
|
1757
|
+
let hadUnsavedEdits = false;
|
|
1757
1758
|
setValues((prev) => {
|
|
1759
|
+
const priorBaseline = dirtyBaselineSnapshotRef.current;
|
|
1760
|
+
hadUnsavedEdits = priorBaseline !== void 0 && createDirtySnapshot(prev) !== priorBaseline;
|
|
1758
1761
|
const merged = { ...prev, ...initialValues };
|
|
1759
1762
|
for (const definition of injectedFieldDefinitions) {
|
|
1760
1763
|
if (merged[definition.id] !== void 0) continue;
|
|
@@ -1784,7 +1787,7 @@ function CrudForm({
|
|
|
1784
1787
|
mergedValues = merged;
|
|
1785
1788
|
return mergedValues;
|
|
1786
1789
|
});
|
|
1787
|
-
if (mergedValues) {
|
|
1790
|
+
if (mergedValues && !hadUnsavedEdits) {
|
|
1788
1791
|
dirtyBaselineSnapshotRef.current = createDirtySnapshot(mergedValues);
|
|
1789
1792
|
}
|
|
1790
1793
|
if (!extendedInjectionEventsEnabled || !mergedValues) return;
|
|
@@ -1798,6 +1801,7 @@ function CrudForm({
|
|
|
1798
1801
|
);
|
|
1799
1802
|
const transformed = result.data;
|
|
1800
1803
|
if (cancelled || !transformed) return;
|
|
1804
|
+
if (isDirtyRef.current) return;
|
|
1801
1805
|
dirtyBaselineSnapshotRef.current = createDirtySnapshot(transformed);
|
|
1802
1806
|
setValues(transformed);
|
|
1803
1807
|
} catch (err) {
|