I'm getting an error in the API that I cannot debug. I am using https://js.arcgis.com/4.24
Error to console happens 2 seconds after window.location.replace.
[esri.views.2d.layers.MapImageLayerView2D] l {name: 'mapimagelayer:image-fetch-error', details: {…}, message: 'Unable to load image: https://gis.manateepao…/services/Website/WebLayers/MapServer/export'}
Loaded scripts (VSCode)
I think you're on the right track, this probably happens because "window.location.replace" causes a new response to be fetched from the server where the MapImageLayer is hosted. Perhaps the "replace" removes the history of the image that was previously fetched already? So it needs to fetch it again? I'm not sure as I haven't used that method before.
Does the new location not have access to the server where the MapImageLayer is hosted? Does the MapImageLayer display normally in the app before the "window.location.replace"? And what is the "window.location.replace" doing for the app?
I have two different views of the map. One view is specific to a data point that a user has searched; it shows all pertinent ArcGIS data for the point. The other view is a full screen map that is launched on a button click event from a different page. Basically a "map" button. With this view, the user can zoom +/- and pan and click where they want, see popup info, or go to the detailed version of the page. The window.location.replace happens when the user exits this map view and needs to go back to the search page.
You can see it live here.