mirror of
https://github.com/element-hq/element-call.git
synced 2026-10-24 02:02:52 +00:00
Don't call posthog before its initialised
This commit is contained in:
1 parent
0dcaa90650
commit
5e4aa53997
2 files changed
+6
-1
No files matched your search
@@ -343,7 +343,8 @@ export const ClientProvider: FC<Props> = ({ children }) => {
|
||||
window.matrixclient = client;
|
||||
window.isPasswordlessUser = isPasswordlessUser;
|
||||
|
||||
PosthogAnalytics.instance.onLoginStatusChanged();
|
||||
if (PosthogAnalytics.hasInstance())
|
||||
PosthogAnalytics.instance.onLoginStatusChanged();
|
||||
}, [client, isPasswordlessUser]);
|
||||
|
||||
if (error) {
|
||||
|
||||
@@ -102,6 +102,10 @@ export class PosthogAnalytics {
|
||||
private platformSuperProperties = {};
|
||||
private registrationType: RegistrationType = RegistrationType.Guest;
|
||||
|
||||
public static hasInstance(): boolean {
|
||||
return Boolean(this.internalInstance);
|
||||
}
|
||||
|
||||
public static get instance(): PosthogAnalytics {
|
||||
if (!this.internalInstance) {
|
||||
this.internalInstance = new PosthogAnalytics(posthog);
|
||||
|
||||
Reference in new issue
Block a user