Merge pull request #17764 from calixteman/telemetry_null_stats

[Editor] Use a null instead of an empty stats object when sending the telemetry
This commit is contained in:
calixteman 2024-03-04 19:16:57 +01:00 committed by GitHub
commit c451b6d684
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -214,7 +214,7 @@ class AnnotationStorage {
}
get editorStats() {
const stats = Object.create(null);
let stats = null;
const typeToEditor = new Map();
for (const value of this.#storage.values()) {
if (!(value instanceof AnnotationEditor)) {
@ -228,6 +228,7 @@ class AnnotationStorage {
if (!typeToEditor.has(type)) {
typeToEditor.set(type, Object.getPrototypeOf(value).constructor);
}
stats ||= Object.create(null);
const map = (stats[type] ||= new Map());
for (const [key, val] of Object.entries(editorStats)) {
if (key === "type") {