Compute a "proper" hash in the AnnotationStorage.prototype.modifiedIds getter

Currently the hash-property is just a stringified Array, which means that the hash-property can become arbitrarily long. That's not a good idea since it's used to compute a cache-key, in the API, which is then sent to the worker-thread. Hence the hash-property should be reasonably short, and its length should *not* depend on the number of modified editors, which can be achieved by using `MurmurHash3_64` here as well.
This commit is contained in:
Jonas Jenwald 2026-04-25 12:52:29 +02:00
parent 30d060c77a
commit b72a229ee8

View File

@ -303,9 +303,15 @@ class AnnotationStorage {
ids.push(value.annotationElementId);
}
}
let hash = "";
if (ids.length) {
const h = new MurmurHash3_64();
h.update(ids.join(","));
hash = h.hexdigest();
}
return (this.#modifiedIds = {
ids: new Set(ids),
hash: ids.join(","),
hash,
});
}