Skip to content

Commit 6a6c7db

Browse files
Aaron Caldwellelasticmachine
andauthored
[Maps] Fix issue preventing TMS from rendering correctly (#71946) (#72203)
* 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> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
1 parent ce91760 commit 6a6c7db

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

x-pack/plugins/maps/public/classes/sources/kibana_tilemap_source/create_source_editor.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* you may not use this file except in compliance with the Elastic License.
55
*/
66

7-
import React from 'react';
7+
import React, { useEffect } from 'react';
88
import PropTypes from 'prop-types';
99
import { EuiFieldText, EuiFormRow, EuiPanel } from '@elastic/eui';
1010

@@ -13,10 +13,12 @@ import { i18n } from '@kbn/i18n';
1313

1414
export function CreateSourceEditor({ onSourceConfigChange }) {
1515
const tilemap = getKibanaTileMap();
16-
17-
if (tilemap.url) {
18-
onSourceConfigChange();
19-
}
16+
useEffect(() => {
17+
if (tilemap.url) {
18+
onSourceConfigChange();
19+
}
20+
// eslint-disable-next-line react-hooks/exhaustive-deps
21+
}, []);
2022

2123
return (
2224
<EuiPanel>
@@ -33,7 +35,7 @@ export function CreateSourceEditor({ onSourceConfigChange }) {
3335
})
3436
}
3537
>
36-
<EuiFieldText readOnly value={tilemap.url} />
38+
<EuiFieldText readOnly value={tilemap.url ? tilemap.url : ''} />
3739
</EuiFormRow>
3840
</EuiPanel>
3941
);

0 commit comments

Comments
 (0)