[Maps] Fix issue preventing TMS from rendering correctly (#71946)

* Ensure getColors selector modifies and returns the same object

* Call onSourceConfigChange on CreateSourceEditor mount

* Back out selector update

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Aaron Caldwell 2020-07-16 17:02:15 -06:00 committed by GitHub
parent 78b39e8b9f
commit 63e6666b13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import React from 'react';
import React, { useEffect } from 'react';
import PropTypes from 'prop-types';
import { EuiFieldText, EuiFormRow, EuiPanel } from '@elastic/eui';
@ -13,10 +13,12 @@ import { i18n } from '@kbn/i18n';
export function CreateSourceEditor({ onSourceConfigChange }) {
const tilemap = getKibanaTileMap();
if (tilemap.url) {
onSourceConfigChange();
}
useEffect(() => {
if (tilemap.url) {
onSourceConfigChange();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return (
<EuiPanel>
@ -33,7 +35,7 @@ export function CreateSourceEditor({ onSourceConfigChange }) {
})
}
>
<EuiFieldText readOnly value={tilemap.url} />
<EuiFieldText readOnly value={tilemap.url ? tilemap.url : ''} />
</EuiFormRow>
</EuiPanel>
);