microsoft / clarity

A behavioral analytics library that uses dom mutations and user interactions to generate aggregated insights.
https://clarity.microsoft.com
MIT License
2.16k stars 214 forks source link

TypeError: Cannot read properties of undefined (reading 'apply') #577

Closed s1mpLyy closed 2 months ago

s1mpLyy commented 7 months ago

When navigating between routes this error happen TypeError: Cannot read properties of undefined (reading 'apply') {snip} ){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return Ai[t].apply(Ai,e)},Li[Ri].v=l;t.length>0;)Li[Ri].apply(Li,t.shift())}}z {snip}

browser : [Chrome Mobile WebView 123.0.6312]

os: Andriod 13

Sentry AI Solution :

Problem Description The error message states: "Cannot read properties of undefined (reading 'apply')". This error occurred in the clarity.js file at line 2. The code snippet involved is a bit too long to show, but it seems to be related to calling a function Ai[t].apply(Ai,e).

Proposed Solution To fix this issue, you'll need to ensure that the object Ai has a property t that is defined and not undefined before attempting to call the apply method on it. You can add a condition to check if Ai[t] exists before making the function call.

Here's an example of how you can modify the code to avoid the error:

if (Ai[t]) { Ai[t].apply(Ai, e); }

JClackett commented 3 months ago

Getting this error quite often in sentry