Skip to content

Commit

Permalink
Fix root errors rendering (#1928)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsuren1 authored Dec 12, 2024
1 parent e2dff1b commit c86b34d
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import React, { useEffect, useRef } from 'react';
import validator from '@rjsf/validator-ajv8';
import Form from '@rjsf/core';
import { Alert } from 'react-bootstrap';
import isEmpty from 'lodash/isEmpty';

import { getMetadataByPk } from '@js/api/geonode/v2/metadata';
import Message from '@mapstore/framework/components/I18N/Message';
import widgets from '../components/_widgets';
Expand All @@ -22,7 +24,7 @@ function MetadataEditor({
pk,
loading,
error,
extraErrors,
extraErrors: __extraErrors,
metadata,
schema,
uiSchema,
Expand Down Expand Up @@ -78,11 +80,14 @@ function MetadataEditor({
return null;
}

const {__errors: rootErrors, ...extraErrors} = __extraErrors ?? {};

return (
<div className="gn-metadata">
<div className="gn-metadata-header">
{updateError && <Alert bsStyle="danger" style={{ margin: '0.25rem 0' }}>
<Message msgId="gnviewer.metadataUpdateError" />
{!isEmpty(rootErrors) && <ul>{rootErrors.map((_error, idx) => <li key={idx}>{_error}</li>)}</ul>}
</Alert>}
</div>
<div className="gn-metadata-container">
Expand Down

0 comments on commit c86b34d

Please sign in to comment.