Skip to content

Commit 9a4f34d

Browse files
authored
fix: single view app update should change comp/diff view left and right apps (#1211)
* fix: after updating app in single view and switching to comparison view left and right queries was on updated
1 parent 8ea4f73 commit 9a4f34d

File tree

3 files changed

+3
-13
lines changed

3 files changed

+3
-13
lines changed

webapp/javascript/hooks/populateLeftRightQuery.hook.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
import { useEffect } from 'react';
2-
import {
3-
actions,
4-
selectQueries,
5-
selectContinuousState,
6-
} from '@webapp/redux/reducers/continuous';
2+
import { actions, selectQueries } from '@webapp/redux/reducers/continuous';
73
import { useAppDispatch, useAppSelector } from '@webapp/redux/hooks';
84

95
// usePopulateLeftRightQuery populates the left and right queries using the main query
106
export default function usePopulateLeftRightQuery() {
117
const dispatch = useAppDispatch();
12-
const { query, leftQuery, rightQuery } = useAppSelector(selectQueries);
8+
const { query } = useAppSelector(selectQueries);
139

1410
// When the query changes (ie the app has changed)
1511
// We populate left and right tags to reflect that application
1612
useEffect(() => {
17-
if (query && !rightQuery) {
13+
if (query) {
1814
dispatch(actions.setRightQuery(query));
19-
}
20-
if (query && !leftQuery) {
2115
dispatch(actions.setLeftQuery(query));
2216
}
2317
}, [query]);

webapp/javascript/pages/ContinuousComparisonView.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ function ComparisonApp() {
8080
<Toolbar
8181
hideTagsBar
8282
onSelectedName={(query) => {
83-
dispatch(actions.setRightQuery(query));
84-
dispatch(actions.setLeftQuery(query));
8583
dispatch(actions.setQuery(query));
8684
}}
8785
/>

webapp/javascript/pages/ContinuousDiffView.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ function ComparisonDiffApp() {
9696
<Toolbar
9797
hideTagsBar
9898
onSelectedName={(query) => {
99-
dispatch(actions.setRightQuery(query));
100-
dispatch(actions.setLeftQuery(query));
10199
dispatch(actions.setQuery(query));
102100
}}
103101
/>

0 commit comments

Comments
 (0)