mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-27 18:18:46 +00:00
- Handle condition where an API field has the same name as one of the "backup" catch-all fields
(cherry picked from commit c80090b3ce)
Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
1 parent
d6255aa772
commit
5cb5bc03eb
1 file changed
+7
-6
@@ -654,12 +654,6 @@ export function ApiForm({
|
|||||||
for (const [k, v] of Object.entries(errors)) {
|
for (const [k, v] of Object.entries(errors)) {
|
||||||
const path = _path ? `${_path}.${k}` : k;
|
const path = _path ? `${_path}.${k}` : k;
|
||||||
|
|
||||||
// Known error keys are displayed as non-field errors
|
|
||||||
if (NON_FIELD_ERROR_KEYS.includes(k)) {
|
|
||||||
processErrors(v);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nested errors (below the top level) cannot be mapped to a form field,
|
// Nested errors (below the top level) cannot be mapped to a form field,
|
||||||
// so they are displayed as non-field errors rather than being dropped
|
// so they are displayed as non-field errors rather than being dropped
|
||||||
if (_path) {
|
if (_path) {
|
||||||
@@ -669,6 +663,13 @@ export function ApiForm({
|
|||||||
|
|
||||||
const field = fields[k];
|
const field = fields[k];
|
||||||
|
|
||||||
|
// Known error keys are displayed as non-field errors,
|
||||||
|
// unless the key matches a form field (e.g. a "reason" field)
|
||||||
|
if (!field && NON_FIELD_ERROR_KEYS.includes(k)) {
|
||||||
|
processErrors(v);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Ignore top-level keys which do not correspond to a form field
|
// Ignore top-level keys which do not correspond to a form field
|
||||||
// (e.g. response metadata such as "transition" or "state")
|
// (e.g. response metadata such as "transition" or "state")
|
||||||
if (!field) {
|
if (!field) {
|
||||||
|
|||||||
Reference in new issue
Block a user