From b72a229ee80de7129bb5e07d9a871b593fffa32c Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Sat, 25 Apr 2026 12:52:29 +0200 Subject: [PATCH] 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. --- src/display/annotation_storage.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/display/annotation_storage.js b/src/display/annotation_storage.js index 312643362..0a1ce895d 100644 --- a/src/display/annotation_storage.js +++ b/src/display/annotation_storage.js @@ -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, }); }