Abstract values fetching out of mapped vis components #658
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First, I created a
VisBoundary
component to hold theErrorBoundary
andSuspense
logic of the vis containers. I did not end up moving theDimensionMapper
into this component, as keeping the mapper in the containers means I could useVisBoundary
in theRawVisContainer
andScalarVisContainer
and removeErrorBoundary
andSuspense
fromVisualizer
.Second, I moved all the data fetching (
useDatasetValue(s)
) out of the mapped visualizations and inside two new components:ValueFetcher
andNxValuesFetcher
. I used the render props pattern, as it is much clearer than my previous state-based solution.Third, I refactored the way we pass formatters to
ScalarVis
andMatrixVis
. Instead of having a guard and an early return in the mapped vis components, I decided to make use of simple type casting.Fourth, I ran
ts-prune
to remove unused exports, notably inguards.ts
.What's next
NxValuesFetcher
so retrying a cancelled NeXus visualization doesn't lead to a refetching waterfall.