Skip to content

Commit

Permalink
fix: remove implict state toggling for spatial underlay in favor of e…
Browse files Browse the repository at this point in the history
…xplict state setting
  • Loading branch information
seve committed Apr 3, 2024
1 parent ffd7281 commit 85cc506
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion client/src/components/embedding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ class Embedding extends React.PureComponent<{}, EmbeddingState> {
track(EVENTS.EXPLORER_LAYOUT_CHOICE_CHANGE_ITEM_CLICKED);

dispatch(actions.layoutChoiceAction(e.currentTarget.value));
if (imageUnderlay && e.target.value !== globals.spatialEmbeddingKeyword) {
if (
imageUnderlay &&
!e.target.value.includes(globals.spatialEmbeddingKeyword)
) {
dispatch({
type: "toggle image underlay",
toggle: false,
});
}
};
Expand Down
3 changes: 3 additions & 0 deletions client/src/components/menubar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class MenuBar extends React.PureComponent<{}, State> {
if (currentConditionMet) {
dispatch({
type: "toggle image underlay",
toggle: true,
});
}
}
Expand All @@ -123,6 +124,7 @@ class MenuBar extends React.PureComponent<{}, State> {
if (!prevConditionMet && currentConditionMet) {
dispatch({
type: "toggle image underlay",
toggle: true,
});
}
}
Expand Down Expand Up @@ -438,6 +440,7 @@ class MenuBar extends React.PureComponent<{}, State> {
onClick={() => {
dispatch({
type: "toggle image underlay",
toggle: !imageUnderlay,
});
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion client/src/reducers/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ const Controls = (
case "toggle image underlay": {
return {
...state,
imageUnderlay: !state.imageUnderlay,
imageUnderlay: action.data.toggle,
};
}
case "request uns metadata started":
Expand Down

0 comments on commit 85cc506

Please sign in to comment.