Select to view content in your preferred language

API 4.33 error, basemapGallery.destroy() generates error.

103
2
Jump to solution
Tuesday
Wimvan_Dijk
Emerging Contributor

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

    render https://js.arcgis.com/4.33/map-components/6HFQH2MH.js:4
    update https://js.arcgis.com/4.33/map-components/M5H3TSRA.js:6
    update https://js.arcgis.com/4.33/map-components/M5H3TSRA.js:6
    performUpdate https://js.arcgis.com/4.33/map-components/M5H3TSRA.js:6
    scheduleUpdate https://js.arcgis.com/4.33/map-components/M5H3TSRA.js:6
    _$EP https://js.arcgis.com/4.33/map-components/M5H3TSRA.js:6
    requestUpdate https://js.arcgis.com/4.33/map-components/M5H3TSRA.js:6
    set https://js.arcgis.com/4.33/map-components/M5H3TSRA.js:6
    set https://js.arcgis.com/4.33/map-components/M5H3TSRA.js:6

 

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?

0 Kudos
1 Solution

Accepted Solutions
AnneFitz
Esri Regular Contributor

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

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.

View solution in original post

2 Replies
AnneFitz
Esri Regular Contributor

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

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.

Wimvan_Dijk
Emerging Contributor

Thank you, appreciated!

0 Kudos