silx-kit / h5web

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

Use zustand store inside suspense fetch store to track progress #1693

Closed axelboc closed 3 months ago

axelboc commented 3 months ago

This replaces the pub-sub pattern I had implemented in DataProviderApi, and considerably simplifies subscribing to the progress state in ValueLoader.

Basically, every fetch store now initialises a zustand store to track progress. Each "fetch input" (e.g. dataset+selection for valuesStore) is associated with a progress percentage in the zustand store, and the store can be subscribed to with zustand's useStore hook.