mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix: prevent sending multiple telemetry events on credential filters reset (#4159)
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user