From ca128a5602b165b9cbdf367da75802bca8ea0755 Mon Sep 17 00:00:00 2001 From: Adrien Boucaud Date: Thu, 6 May 2021 19:24:32 +0200 Subject: [PATCH] fix(httpdatasetreader): when caching array data, differentiate by class The reader caches array instances to avoid having to load the same array multiple times. Arrays are cached using a hash of the binary data they contain. This means a vtkPoints and vtkDataArray sharing the same data could be cached under the same index. This case can happen quite often with empty meshes, as all arrays will share the same hash. This appends the class type to the caching key to avoid these conflicts. --- Sources/IO/Core/HttpDataSetReader/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/IO/Core/HttpDataSetReader/index.js b/Sources/IO/Core/HttpDataSetReader/index.js index 6ed287537d2..31edf91c6b7 100644 --- a/Sources/IO/Core/HttpDataSetReader/index.js +++ b/Sources/IO/Core/HttpDataSetReader/index.js @@ -144,7 +144,7 @@ function vtkHttpDataSetReader(publicAPI, model) { // Internal method to fetch Array function fetchArray(array, options = {}) { - const arrayId = array.ref.id; + const arrayId = `${array.ref.id}|${array.vtkClass}`; if (!cachedArrays[arrayId]) { // Cache the promise while fetching cachedArrays[arrayId] = model.dataAccessHelper