silx-kit / h5web

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

Add way to reset fetch cache of relevant providers #1673

Closed axelboc closed 5 months ago

axelboc commented 5 months ago

Addresses https://github.com/silx-kit/h5web/discussions/1553#discussioncomment-9787236

I was wrong about key not resetting the state of children components, so I'm adding a resetKeys array prop to three providers: H5GroveProvider, HsdsProvider and H5WasmLocalFileProvider to allow resetting the fetch cache manually. This prop is inspired from react-error-boundary.

I've tested and it works great: the suspense fallbacks in the explorer and in the visualizer are triggered again as expected. This even works with local files, which will benefit the VS Code extension.