fix(editor): Fix for logging error on user logout (#4633)

* 🐛 Fixing telemetry errors on user logout
* 🔥 Removing call to `rudder.indentify` when users log out
* 👌 Addressing review comment
Co-authored-by: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com>
Co-authored-by: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com>
This commit is contained in:
Milorad FIlipović 2022-11-17 14:20:09 +01:00 committed by GitHub
parent 0daa36c197
commit 7483e147fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 10 deletions

View file

@ -33,22 +33,19 @@ export default mixins(externalHooks).extend({
telemetry(): ITelemetrySettings {
return this.settingsStore.telemetry;
},
isTelemetryEnabled(): boolean {
return !!this.telemetry?.enabled;
},
},
mounted() {
this.init();
},
methods: {
init() {
if (this.isTelemetryInitialized || !this.isTelemetryEnabledOnRoute) return;
const telemetrySettings = this.telemetry;
if (!telemetrySettings || !telemetrySettings.enabled) {
return;
}
if (this.isTelemetryInitialized || !this.isTelemetryEnabledOnRoute || !this.isTelemetryEnabled) return;
this.$telemetry.init(
telemetrySettings,
this.telemetry,
{
instanceId: this.rootStore.instanceId,
userId: this.currentUserId,
@ -69,7 +66,9 @@ export default mixins(externalHooks).extend({
this.init();
},
currentUserId(userId) {
this.$telemetry.identify(this.rootStore.instanceId, userId);
if (this.isTelemetryEnabled) {
this.$telemetry.identify(this.rootStore.instanceId, userId);
}
this.$externalHooks().run('telemetry.currentUserIdChanged', {
instanceId: this.rootStore.instanceId,
userId,

View file

@ -87,7 +87,6 @@ export class Telemetry {
}
else {
this.rudderStack.reset();
this.rudderStack.identify(undefined, traits);
}
}