Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Correctly load image underlay when initial layout is spatial #859

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions client/src/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ const doInitialDataLoad = (): ((
datasetMetadataFetchAndLoad(dispatch, oldPrefix, config);
// TODO: add logic to ensure this is working for spatial datasets when flag removed
if (isSpatial) {
// (seve): maybe we should be fetching spatial images here too as well
datasetSpatialMetadataFetchAndLoad(dispatch);
}
const baseDataUrl = `${globals.API.prefix}${globals.API.version}`;
Expand Down
1 change: 1 addition & 0 deletions client/src/components/graph/graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,7 @@ class Graph extends React.Component<GraphProps, GraphState> {

this.isSpatial = getFeatureFlag(FEATURES.SPATIAL);

// (seve): this is leading to multiple image downloads, if this isn't large, maybe we should do it as part of the initial load and store it in redux
this.spatialImage = this.isSpatial
? await this.loadTextureFromUrl(
`${globals.API?.prefix}${globals.API?.version}spatial/image`
Expand Down
13 changes: 13 additions & 0 deletions client/src/components/menubar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,22 @@ class MenuBar extends React.PureComponent<{}, State> {
// eslint-disable-next-line @typescript-eslint/ban-types --- FIXME: disabled temporarily on migrate to TS.
constructor(props: {}) {
super(props);
// @ts-expect-error ts-migrate(2339) FIXME: Property 'dispatch' does not exist on type 'Readon... Remove this comment to see the full error message
const { layoutChoice, dispatch } = this.props;
this.state = {
pendingClipPercentiles: null,
};
const currentConditionMet = layoutChoice?.current?.includes(
globals.spatialEmbeddingKeyword
);
// (seve): On some datasets, the app initially loads with a different layout selected, then switches to spatial.
// This triggers the componentDidUpdate, which toggles the image underlay.
// Other datasets correctly load with the spatial layout initially selected, but then don't trigger the componentDidUpdate.
if (currentConditionMet) {
dispatch({
type: "toggle image underlay",
});
}
}

componentDidUpdate(prevProps: any): void {
Expand Down
Loading