diff --git a/components/operators-detail/fmus.js b/components/operators-detail/fmus.js index a70adcae..e23995bc 100644 --- a/components/operators-detail/fmus.js +++ b/components/operators-detail/fmus.js @@ -131,9 +131,10 @@ class OperatorsDetailFMUs extends React.Component { componentWillUnmount() { // Attribution listener - document - .getElementById('forest-atlas-attribution') - .removeEventListener('click', this.onCustomAttribute); + const faElement = document.getElementById('forest-atlas-attribution'); + if (faElement) { + faElement.removeEventListener('click', this.onCustomAttribute); + } } // eslint-disable-next-line class-methods-use-this @@ -212,6 +213,7 @@ class OperatorsDetailFMUs extends React.Component { const { fmu, fmus, + operatorsDetail, operatorsDetailFmus, activeLayers, activeInteractiveLayersIds, @@ -224,6 +226,24 @@ class OperatorsDetailFMUs extends React.Component { ({ value }) => fmu[`certification-${value}`] ).map((ct) => ct.label); + // use loaded operator data to not have flickering message when more fmus data is still loading (fmus property) + const operatorHasNoFMUS = operatorsDetail.data && (!operatorsDetail.data.fmus || !operatorsDetail.data.fmus.length); + + if (operatorHasNoFMUS) { + return ( +