silx-kit / h5web

React components for data visualization and exploration
https://h5web.panosc.eu/
MIT License
183 stars 18 forks source link

Fetch opaque datasets with h5grove as binary #1587

Closed axelboc closed 6 months ago

axelboc commented 6 months ago

This change is in preparation for #1554.

Opaque datasets were so far fetched with h5grove as JSON, which led to back-end errors for datasets that cannot be encoded to strings (like datetime64_scalar).

I now fetch opaque datasets as binary and return UInt8Array values from H5GroveProvider for consistency with H5WasmProvider.

With h5grove@2.0.0, this change leads to 422 errors for all opaque datasets. This will be fixed with https://github.com/silx-kit/h5grove/pull/89 and a new release of h5grove. This PR therefore constitutes somewhat a breaking change.

While I'm at it, I also improve the display of UInt8Array values slightly in RawVis by simply calling toString() instead of JSON.stringify():

image image

axelboc commented 6 months ago

I've updated the h5grove demo back-end following the merge of https://github.com/silx-kit/h5grove/pull/89. As planned, we no longer get 422 errors when fetching opaque datasets and the values for those datasets in h5grove-api.test.ts.snap now match the values in h5wasm-api.test.ts.snap. :tada: