silx-kit / h5web

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

Add _Nx Note_ visualization #1606

Closed axelboc closed 2 months ago

axelboc commented 2 months ago

Fix #1603

image

Nothing crazy, but there is a subtlety: the MIME type is stored in a dataset and not an attribute (:shrug:), which means that with our current architecture, we don't have access to it when looking for supported visualizations. We can only detect that the group has NX_class=NXnote, render NxNoteContainer, and only then fetch the values of the data and type datasets. So if the MIME type is not JSON, we get:

image

When ideally, it would be nicer to show the default fallback (without the NX Note tab):

image

I could refactor the visualization detection code so it allows fetching dataset values. The downside is that it will trigger the suspense fallback that wraps the whole Visualizer. I guess it's okay as long as we fetch only datasets that contain metadata and not actual data... Any thoughts @loichuder?

axelboc commented 2 months ago

/approve

loichuder commented 2 months ago

I could refactor the visualization detection code so it allows fetching dataset values. The downside is that it will trigger the suspense fallback that wraps the whole Visualizer. I guess it's okay as long as we fetch only datasets that contain metadata and not actual data... Any thoughts @loichuder?

I think it is fine as it is for several reasons: