Cannot read properties of undefined (reading '$refs')

Hello

I am trying to integrate Tawk.to into my web app. I was very happy to find the .login() method; this will help me identify the user I am chatting with.

Here’s my code

            window.Tawk_API = window.Tawk_API || {};
            window.Tawk_API.autoStart = false;
            window.Tawk_API.onLoad = function(){
                    Tawk_API.start();
                     Tawk_API.login(user); 

                    setTimeout(function (){
                        Tawk_API.maximize();

                    }, 1000);
            };

All of the above works well. But once the widget is maximized, it suddenly gets hidden again, and I get the following error:

twk-chunk-24d8db78.js:2 Uncaught TypeError: Cannot read properties of undefined (reading '$refs')
    at a.autoFocusChatInput (twk-chunk-24d8db78.js:2:88882)
    at twk-chunk-24d8db78.js:2:89045

Hello

Any help would be appreciated.

Thanks

So there’s no support! That’s big red flag! Why would anyone subscribe to a tech service ,with no tech support behind it!

Hi, bumping this because I’m having the same issue. tawk.to widget seems to consistently spit out errors on iOS & OSX devices, this being the most frequent one.

TypeError: undefined is not an object (evaluating 't.$refs["tawk-message-preview-content"].clientHeight')

The actual breaking code in question for me seems to be within this snippet:

recalculateHeight: function() {
  var t = this;
  setTimeout((function() {
    t.height = t.$refs["tawk-message-preview-content"].clientHeight + 10;
    var e = window.innerHeight - t.previewYOffset - t.$refs["tawk-chatinput-container"].clientHeight - 45;
    t.$refs["tawk-chat-message-container"].style["max-height"] = "".concat(e * t.zoomRatio, "px"), t.$refs["tawk-chat-message-container"].scrollTop = 999999999, t.scaleContent()
  }), 1e3)
},

This snippet has been beautified from a vendor script served to the client. The one from the following url: https://embed.tawk.to/_s/v4/app/66909c6d5c9/js/twk-chunk-48f3b594.js

The client height here and elsewhere appears to not be accessible when using Safari. I sadly cannot provide much more additional context than this, we’ve only seen these errors come through our reporting software and don’t have any Apple devices immediately handy to debug this myself.

There’s also a decent chunk of other errors that come from the tawk.to widget, all of which are unhandled. These have different conditions and I’ve not checked for root causes yet, but would it be possible that as many of the exceptions that come from the JS widget are caught & handled?

Thanks.