@overmap-ai/core 1.0.35-fix-token-refresh-loop.2 → 1.0.35-fix-token-refresh-loop.3
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.
|
@@ -10225,9 +10225,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10225
10225
|
PatchField.displayName = "PatchField";
|
|
10226
10226
|
const PatchFormProvider = React.memo(
|
|
10227
10227
|
React.forwardRef((props, ref) => {
|
|
10228
|
-
const { children, schema, values, onPatch, onError, requiresDiff = true, ...rest } = props;
|
|
10228
|
+
const { children, schema, values, onPatch, onError, requiresDiff = true, onDirtyChange, ...rest } = props;
|
|
10229
10229
|
const initialValues2 = React.useMemo(() => initialFormValues(schema.fields, values), [schema.fields, values]);
|
|
10230
|
-
const
|
|
10230
|
+
const getDiff = React.useCallback(
|
|
10231
10231
|
(values2) => {
|
|
10232
10232
|
const diff = {};
|
|
10233
10233
|
for (const key in values2) {
|
|
@@ -10236,11 +10236,18 @@ var __publicField = (obj, key, value) => {
|
|
|
10236
10236
|
diff[key] = value;
|
|
10237
10237
|
}
|
|
10238
10238
|
}
|
|
10239
|
+
return diff;
|
|
10240
|
+
},
|
|
10241
|
+
[initialValues2]
|
|
10242
|
+
);
|
|
10243
|
+
const handlePatch = React.useCallback(
|
|
10244
|
+
(values2) => {
|
|
10245
|
+
const diff = getDiff(values2);
|
|
10239
10246
|
if (requiresDiff && !hasKeys(diff))
|
|
10240
10247
|
return;
|
|
10241
10248
|
onPatch(diff);
|
|
10242
10249
|
},
|
|
10243
|
-
[
|
|
10250
|
+
[getDiff, onPatch, requiresDiff]
|
|
10244
10251
|
);
|
|
10245
10252
|
const validate = React.useCallback(
|
|
10246
10253
|
(form) => {
|
|
@@ -10248,9 +10255,13 @@ var __publicField = (obj, key, value) => {
|
|
|
10248
10255
|
if (error2) {
|
|
10249
10256
|
onError(error2);
|
|
10250
10257
|
}
|
|
10258
|
+
if (onDirtyChange) {
|
|
10259
|
+
const diff = getDiff(form);
|
|
10260
|
+
onDirtyChange(hasKeys(diff));
|
|
10261
|
+
}
|
|
10251
10262
|
return error2;
|
|
10252
10263
|
},
|
|
10253
|
-
[schema, onError]
|
|
10264
|
+
[schema, onDirtyChange, onError, getDiff]
|
|
10254
10265
|
);
|
|
10255
10266
|
const formik$1 = formik.useFormik({
|
|
10256
10267
|
initialValues: initialValues2,
|