Fix exception when loading PostHog

PostHog was expecting the matrix client object to be initialised at
the point it ran its setup, which wasn't the case. Check to see if it's
there on login and add an onLoginStatusChanged hook that to re-check.

Also make a few methods private that didn't need to be public.

Also fix a few instances where the OpenTelemetry group call tried to
report metrics using a tracer which didn't exist anymore, if the user
disabled analytics and then joined the same call again.
This commit is contained in:
David Baker
2023-04-05 13:06:55 +01:00
parent 7b88c4330e
commit 0dcaa90650
3 changed files with 24 additions and 5 deletions

View File

@@ -342,6 +342,8 @@ export const ClientProvider: FC<Props> = ({ children }) => {
useEffect(() => {
window.matrixclient = client;
window.isPasswordlessUser = isPasswordlessUser;
PosthogAnalytics.instance.onLoginStatusChanged();
}, [client, isPasswordlessUser]);
if (error) {