Skip to content

Commit

Permalink
[Maps] Fix issue preventing TMS from rendering correctly (#71946)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Aaron Caldwell and elasticmachine committed Jul 16, 2020
1 parent 79416c1 commit 3268ef3
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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>
Expand All @@ -33,7 +35,7 @@ export function CreateSourceEditor({ onSourceConfigChange }) {
})
}
>
<EuiFieldText readOnly value={tilemap.url} />
<EuiFieldText readOnly value={tilemap.url ? tilemap.url : ''} />
</EuiFormRow>
</EuiPanel>
);
Expand Down

0 comments on commit 3268ef3

Please sign in to comment.