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
2 changed files with 8 additions and 10 deletions

View File

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

View File

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