In my code I dynamically add a basemapGallery:
basemapGallery = document.createElement('arcgis-basemap-gallery');
basemapGallery.position = "bottom-right";
mapDiv.appendChild(basemapGallery);
I remove the basemapGallery by pressing a button:
if (basemapGallery.destroy && typeof basemapGallery.destroy === 'function') { basemapGallery.destroy(); }
basemapGallery = null;
Using API 4.32 this works when I use the imports:
<link rel="stylesheet" href="/arcgis_js/javascript/4.32/esri/themes/light/main.css">
<script src="/arcgis_js/javascript/4.32/init.js"></script>
<script type="module" src="https://js.arcgis.com/map-components/4.32/index.js"></script>
But when I use the API 4.33 imports, I get an error on basemapGallery.destroy():
<link rel="stylesheet" href="/arcgis_js/javascript/4.33/esri/themes/light/main.css">
<script src="/arcgis_js/javascript/4.33/init.js"></script>
<script type="module" src="https://js.arcgis.com/map-components/4.33/index.js"></script>
The error is:
Uncaught (in promise) TypeError: can't access property "state", this.source is undefined
When I change the last import line to version 4.32 it works without the error
<link rel="stylesheet" href="/arcgis_js/javascript/4.33/esri/themes/light/main.css">
<script src="/arcgis_js/javascript/4.33/init.js"></script>
<script type="module" src="https://js.arcgis.com/map-components/4.32/index.js"></script>
Is there something I overlooked or is this an API error?
Solved! Go to Solution.
Hi @Wimvan_Dijk - this is an API error. We have a fix that will be released with version 4.34 next month.
If you want to test out the fix ahead of the release, you can do so on our development version of the CDN:
https://js.arcgis.com/next/map-components/
Note that as of 4.33, there is a new CDN endpoint for components where the version number comes before the component package for consistency with the core API CDN! See https://developers.arcgis.com/javascript/latest/release-notes/#new-cdn-endpoint-for-components for more info.
Hi @Wimvan_Dijk - this is an API error. We have a fix that will be released with version 4.34 next month.
If you want to test out the fix ahead of the release, you can do so on our development version of the CDN:
https://js.arcgis.com/next/map-components/
Note that as of 4.33, there is a new CDN endpoint for components where the version number comes before the component package for consistency with the core API CDN! See https://developers.arcgis.com/javascript/latest/release-notes/#new-cdn-endpoint-for-components for more info.
Thank you, appreciated!