|
16 | 16 | */
|
17 | 17 |
|
18 | 18 | import { Tickets } from '@/v5/ui/routes/viewer/tickets/tickets.component';
|
19 |
| -import { isEmpty } from 'lodash'; |
| 19 | +import { isEmpty, isEqual } from 'lodash'; |
20 | 20 | import { PureComponent } from 'react';
|
21 | 21 | import { Toolbar } from '@/v5/ui/routes/viewer/toolbar/toolbar.component';
|
| 22 | +import { ITicket } from '@/v5/store/tickets/tickets.types'; |
| 23 | +import { goToView } from '@/v5/helpers/viewpoint.helpers'; |
| 24 | +import { AdditionalProperties } from '@/v5/ui/routes/viewer/tickets/tickets.constants'; |
22 | 25 | import { VIEWER_EVENTS } from '../../constants/viewer';
|
23 | 26 | import { getViewerLeftPanels, VIEWER_PANELS } from '../../constants/viewerGui';
|
24 | 27 | import { getWindowHeight, getWindowWidth, renderWhenTrue } from '../../helpers/rendering';
|
@@ -67,6 +70,7 @@ interface IProps {
|
67 | 70 | rightPanels: string[];
|
68 | 71 | draggablePanels: string[];
|
69 | 72 | disabledPanelButtons: Set<string>;
|
| 73 | + selectedTicket: ITicket | null | undefined; |
70 | 74 | stopListenOnSelections: () => void;
|
71 | 75 | stopListenOnModelLoaded: () => void;
|
72 | 76 | stopListenOnClickPin: () => void;
|
@@ -181,6 +185,14 @@ export class ViewerGui extends PureComponent<IProps, IState> {
|
181 | 185 | this.props.setPanelVisibility(VIEWER_PANELS.COMPARE, false);
|
182 | 186 | this.props.resetCompareComponent();
|
183 | 187 | }
|
| 188 | + |
| 189 | + const prevView = prevProps.selectedTicket?.properties?.[AdditionalProperties.DEFAULT_VIEW]; |
| 190 | + const currView = this.props.selectedTicket?.properties?.[AdditionalProperties.DEFAULT_VIEW]; |
| 191 | + |
| 192 | + if (!isEqual(prevView, currView)) { |
| 193 | + // This is for not refreshing the view when exiting a selected ticket |
| 194 | + goToView(currView); |
| 195 | + } |
184 | 196 | }
|
185 | 197 |
|
186 | 198 | public componentWillUnmount() {
|
|
0 commit comments