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

Time Travel: unmount in the shutdown() action #2801

Merged
merged 2 commits into from
Aug 10, 2017
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
32 changes: 20 additions & 12 deletions client/app/scripts/actions/app-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,16 @@ export function receiveNodesDelta(delta) {

export function resumeTime() {
return (dispatch, getState) => {
dispatch({
type: ActionTypes.RESUME_TIME
});
// After unpausing, all of the following calls will re-activate polling.
getTopologies(getState, dispatch);
getNodes(getState, dispatch, true);
if (isResourceViewModeSelector(getState())) {
getResourceViewNodesSnapshot(getState(), dispatch);
if (isPausedSelector(getState())) {
dispatch({
type: ActionTypes.RESUME_TIME
});
// After unpausing, all of the following calls will re-activate polling.
getTopologies(getState, dispatch);
getNodes(getState, dispatch, true);
if (isResourceViewModeSelector(getState())) {
getResourceViewNodesSnapshot(getState(), dispatch);
}
}
};
}
Expand Down Expand Up @@ -796,10 +798,16 @@ export function changeInstance() {
}

export function shutdown() {
stopPolling();
teardownWebsockets();
return {
type: ActionTypes.SHUTDOWN
return (dispatch) => {
stopPolling();
teardownWebsockets();
// Exit the time travel mode before unmounting the app.
dispatch({
type: ActionTypes.RESUME_TIME
});
dispatch({
type: ActionTypes.SHUTDOWN
});
};
}

Expand Down
5 changes: 0 additions & 5 deletions client/app/scripts/components/time-travel.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ class TimeTravel extends React.Component {
this.setState(getTimestampStates(props.pausedAt));
}

componentWillUnmount() {
// TODO: Get rid of this somehow. See: https://github.com/weaveworks/service-ui/issues/814
this.props.resumeTime();
}

handleInputChange(ev) {
const timestamp = moment(ev.target.value);
this.setState({ inputValue: ev.target.value });
Expand Down