Error after calling WebViewer::shutdown method and opening a new view

I have an angular application using hoops webviewer, and when I try to clean up the viewer when I destroy the component I get the following error when creating a new component with a new view:

chunk-TWWAJFRB.js?v=b86aec02:68 Rejected promise in '_sessionStarted' callback: TypeError: Cannot set properties of undefined (setting 'width')
    at rb._resizeRenderCanvas (hoops-web-viewer.mjs:41108:11)
    at rb.resize (hoops-web-viewer.mjs:41100:128)
    at rb.setAllowHighDpi (hoops-web-viewer.mjs:41284:37)
    at rb.<anonymous> (hoops-web-viewer.mjs:40484:10)
    at Generator.next (<anonymous>)
    at chunk-TWWAJFRB.js?v=b86aec02:74:61
    at ZoneAwarePromise (zone.js:2702:25)
    at __async (chunk-TWWAJFRB.js?v=b86aec02:58:10)
    at rb._onSessionStarted (hoops-web-viewer.mjs:40483:29)
    at _sessionStarted (hoops-web-viewer.mjs:40245:39)

Digging a little into the hoops code, I can see that on the first load, the value of ._sc.canvas is an OffscreenCanvas, but on the second load after destroy it is undefined, causing this issue.

Any help much appreciated :slight_smile:

Hello @zak,

Welcome to the forum!

The issue you described has previously been reported. I can tell you that it has been escalated to our engineering team and the investigation is ongoing.

Thanks,
Tino

Thanks Tino,

Is there any progress on the investigation into this issue? If not I’ll start looking into alternative workarounds like detaching the viewer when the page is unloaded and reattaching it on return navigation to avoid it ever being destroyed. This would be an unfortunate hack if necessary.

Hello @zak,

The fix for this issue is slated to be included in the next Communicator release — which is HC 2024.8.0 (with a forecasted release date of November 26, 2024).

Thanks,
Tino

Thanks @tino, confirmed this issue no longer occurs in 2024.8.0

1 Like