@overmap-ai/core 1.0.35-fix-token-refresh-loop.0 → 1.0.35-fix-token-refresh-loop.2
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.
|
@@ -19,6 +19,8 @@ interface PatchFormProviderProps {
|
|
|
19
19
|
* ``` */
|
|
20
20
|
onError: (error: FormikErrors<Form | NewForm>) => void;
|
|
21
21
|
className?: string;
|
|
22
|
+
/** If true, the form will only submit if there are changes. */
|
|
23
|
+
requiresDiff?: boolean;
|
|
22
24
|
}
|
|
23
25
|
/** Use PatchForms to create patch edits to existing forms rather than editing the entire form. */
|
|
24
26
|
export declare const PatchFormProvider: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<PatchFormProviderProps & import("react").RefAttributes<HTMLFormElement>>>;
|
package/dist/overmap-core.js
CHANGED
|
@@ -3465,6 +3465,19 @@ function extractErrorMessage(errorRes, err) {
|
|
|
3465
3465
|
return errorRes.body.error;
|
|
3466
3466
|
if (typeof errorRes.body.message === "string")
|
|
3467
3467
|
return errorRes.body.message;
|
|
3468
|
+
try {
|
|
3469
|
+
return Object.entries(errorRes.body).map(([key, value]) => {
|
|
3470
|
+
if (typeof value === "string") {
|
|
3471
|
+
return `${key}: ${value}`;
|
|
3472
|
+
}
|
|
3473
|
+
if (Array.isArray(value)) {
|
|
3474
|
+
return value.map((v) => `${key}: ${v}`).join("\n");
|
|
3475
|
+
}
|
|
3476
|
+
return `${key}: ${JSON.stringify(value)}`;
|
|
3477
|
+
}).join("\n");
|
|
3478
|
+
} catch (e) {
|
|
3479
|
+
console.error("Failed to extract error message from response body", e);
|
|
3480
|
+
}
|
|
3468
3481
|
} else if (typeof errorRes.body === "string")
|
|
3469
3482
|
return errorRes.body;
|
|
3470
3483
|
} else if (errorRes == null ? void 0 : errorRes.text) {
|
|
@@ -10216,7 +10229,7 @@ const PatchField = memo((props) => {
|
|
|
10216
10229
|
PatchField.displayName = "PatchField";
|
|
10217
10230
|
const PatchFormProvider = memo(
|
|
10218
10231
|
forwardRef((props, ref) => {
|
|
10219
|
-
const { children, schema, values, onPatch, onError, ...rest } = props;
|
|
10232
|
+
const { children, schema, values, onPatch, onError, requiresDiff = true, ...rest } = props;
|
|
10220
10233
|
const initialValues2 = useMemo(() => initialFormValues(schema.fields, values), [schema.fields, values]);
|
|
10221
10234
|
const handlePatch = useCallback(
|
|
10222
10235
|
(values2) => {
|
|
@@ -10227,11 +10240,11 @@ const PatchFormProvider = memo(
|
|
|
10227
10240
|
diff[key] = value;
|
|
10228
10241
|
}
|
|
10229
10242
|
}
|
|
10230
|
-
if (!hasKeys(diff))
|
|
10243
|
+
if (requiresDiff && !hasKeys(diff))
|
|
10231
10244
|
return;
|
|
10232
10245
|
onPatch(diff);
|
|
10233
10246
|
},
|
|
10234
|
-
[initialValues2, onPatch]
|
|
10247
|
+
[initialValues2, onPatch, requiresDiff]
|
|
10235
10248
|
);
|
|
10236
10249
|
const validate = useCallback(
|
|
10237
10250
|
(form) => {
|