ArcGis version:
"@arcgis/core": "4.26.5",
According to your own post about using ArcGis with React, we should have a useEffect that unsets the views container, which seems like the way to go for freeing up the resources \ WebGL contexts created.
useEffect(() => {
... Map initialization
return () => (view.container = null);
}, []);
Using React with the ArcGIS API for JavaScript (esri.com)
But your Typescript definition says that view.container needs to be a HTMLDivElement
export class DOMContainer {
/**
* The `id` or node representing the DOM element containing the view.
*
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-DOMContainer.html#container)
*/
container: HTMLDivElement;
...
While you initializer allows more options:
interface DOMContainerProperties {
/**
* The `id` or node representing the DOM element containing the view.
*
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-DOMContainer.html#container)
*/
container?: HTMLDivElement | string;
The workaround is to do:
useEffect(() => {
... Map initialization
return () => (view.container = null as any);
}, []);
But i believe the Typescript definition should be updated, if this is the preferred way to cleanup.