You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I switch from Crocodoc.LAYOUT_HORIZONTAL to Crocodoc.LAYOUT_VERTICAL it happens an error (TypeError: Cannot read property 'width' of undefined) and the vertical layout is not set right.
I've checked the code and figured out that the problem happens because viewerBase.setLayout broadcasts a layoutchange message before returning. This message is caught by viewer-base that calls viewer.updateLayout that is still with the old (but already destroyed) layout reference.
A simple solution is to change the viewer.setLayout method and nullify the layout reference before calling viewerBase.setLayout. That way, the old reference doesn't exist anymore when the message is handled. I tested it myself and it worked fine.
Is this the best solution? I could open a pull request with this change if necessary.
Thanks.
The text was updated successfully, but these errors were encountered:
When I switch from
Crocodoc.LAYOUT_HORIZONTAL
toCrocodoc.LAYOUT_VERTICAL
it happens an error (TypeError: Cannot read property 'width' of undefined) and the vertical layout is not set right.I've checked the code and figured out that the problem happens because
viewerBase.setLayout
broadcasts alayoutchange
message before returning. This message is caught by viewer-base that callsviewer.updateLayout
that is still with the old (but already destroyed) layout reference.A simple solution is to change the
viewer.setLayout
method and nullify the layout reference before callingviewerBase.setLayout
. That way, the old reference doesn't exist anymore when the message is handled. I tested it myself and it worked fine.Is this the best solution? I could open a pull request with this change if necessary.
Thanks.
The text was updated successfully, but these errors were encountered: