Skip to content
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
2 changes: 2 additions & 0 deletions src/reducers/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ const lastVisibleThreadTabSlug: Reducer<TabSlug> = (
return action.selectedTab;
}
return state;
case 'FOCUS_CALL_TREE':
return 'calltree';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a huge fan of this lastVisibleThreadTabSlug, it's missing some corner cases (for example when navigating using the URL only, either loading a URL with another slug than calltree at load time, or navigating with back/forward). But I didn't want to change all of this now :-)

(reminder: this state links the network chart and the network track, so that when changing the track back to another track, we go back at the previous selected tab too)

default:
return state;
}
Expand Down
2 changes: 2 additions & 0 deletions src/reducers/url-state.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ const selectedTab: Reducer<TabSlug> = (state = 'calltree', action) => {
case 'CHANGE_SELECTED_TAB':
case 'SELECT_TRACK':
return action.selectedTab;
case 'FOCUS_CALL_TREE':
return 'calltree';
default:
return state;
}
Expand Down
16 changes: 16 additions & 0 deletions src/test/components/TrackThread.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ import {
changeInvertCallstack,
changeSelectedCallNode,
} from '../../actions/profile-view';
import { changeSelectedTab } from '../../actions/app';
import { TimelineTrackThread } from '../../components/timeline/TrackThread';
import { getPreviewSelection } from '../../selectors/profile';
import { selectedThreadSelectors } from '../../selectors/per-thread';
import { getSelectedTab } from '../../selectors/url-state';
import { getLastVisibleThreadTabSlug } from '../../selectors/app';
import { ensureExists } from '../../utils/flow';

import {
Expand Down Expand Up @@ -188,6 +191,19 @@ describe('timeline/TrackThread', function () {
expect(getCallNodePath()).toEqual(['j', 'k', 'l']);
});

it('when clicking a stack, this selects the call tree panel', function () {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find a test using the activity graph, but using the stack graph canvas works too :-D

const { dispatch, getState, stackGraphCanvas, getFillRectCenterByIndex } =
setup(getSamplesProfile());

dispatch(changeSelectedTab('marker-chart'));

const log = flushDrawLog();

fireFullClick(stackGraphCanvas(), getFillRectCenterByIndex(log, 0));
expect(getSelectedTab(getState())).toBe('calltree');
expect(getLastVisibleThreadTabSlug(getState())).toBe('calltree');
});

it('can click a stack in the stack graph in inverted call trees', function () {
const {
dispatch,
Expand Down