mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: prevent sending multiple telemetry events on credential filters reset (#4159)
This commit is contained in:
parent
3df5ea5ebd
commit
a71f3622e2
|
@ -286,6 +286,7 @@ export default mixins(
|
||||||
ownedBy: '',
|
ownedBy: '',
|
||||||
sharedWith: '',
|
sharedWith: '',
|
||||||
},
|
},
|
||||||
|
resettingFilters: false,
|
||||||
EnterpriseEditionFeature,
|
EnterpriseEditionFeature,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -412,6 +413,9 @@ export default mixins(
|
||||||
this.filtersInput.type = [];
|
this.filtersInput.type = [];
|
||||||
this.filtersInput.ownedBy = '';
|
this.filtersInput.ownedBy = '';
|
||||||
this.filtersInput.sharedWith = '';
|
this.filtersInput.sharedWith = '';
|
||||||
|
|
||||||
|
this.resettingFilters = true;
|
||||||
|
this.sendFiltersTelemetry('reset');
|
||||||
},
|
},
|
||||||
focusSearchInput() {
|
focusSearchInput() {
|
||||||
if (this.$refs.search) {
|
if (this.$refs.search) {
|
||||||
|
@ -436,7 +440,17 @@ export default mixins(
|
||||||
sorting: this.filters.sortBy,
|
sorting: this.filters.sortBy,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sendFiltersTelemetry() {
|
sendFiltersTelemetry(source: string) {
|
||||||
|
// Prevent sending multiple telemetry events when resetting filters
|
||||||
|
// Timeout is required to wait for search debounce to be over
|
||||||
|
if (this.resettingFilters) {
|
||||||
|
if (source !== 'reset') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(() => this.resettingFilters = false, 1500);
|
||||||
|
}
|
||||||
|
|
||||||
const filters = this.filters as Record<string, string[] | string | boolean>;
|
const filters = this.filters as Record<string, string[] | string | boolean>;
|
||||||
const filtersSet: string[] = [];
|
const filtersSet: string[] = [];
|
||||||
const filterValues: Array<string[] | string | boolean | null> = [];
|
const filterValues: Array<string[] | string | boolean | null> = [];
|
||||||
|
@ -468,16 +482,16 @@ export default mixins(
|
||||||
if (value) {
|
if (value) {
|
||||||
this.setOwnerFilter(false);
|
this.setOwnerFilter(false);
|
||||||
}
|
}
|
||||||
this.sendFiltersTelemetry();
|
this.sendFiltersTelemetry('ownedBy');
|
||||||
},
|
},
|
||||||
'filters.sharedWith'() {
|
'filters.sharedWith'() {
|
||||||
this.sendFiltersTelemetry();
|
this.sendFiltersTelemetry('sharedWith');
|
||||||
},
|
},
|
||||||
'filters.type'() {
|
'filters.type'() {
|
||||||
this.sendFiltersTelemetry();
|
this.sendFiltersTelemetry('type');
|
||||||
},
|
},
|
||||||
'filters.search'() {
|
'filters.search'() {
|
||||||
this.callDebounced('sendFiltersTelemetry', { debounceTime: 1000, trailing: true });
|
this.callDebounced('sendFiltersTelemetry', { debounceTime: 1000, trailing: true }, 'search');
|
||||||
},
|
},
|
||||||
'filters.sortBy'() {
|
'filters.sortBy'() {
|
||||||
this.sendSortingTelemetry();
|
this.sendSortingTelemetry();
|
||||||
|
|
Loading…
Reference in a new issue