diff --git a/static/app/views/eventsV2/table/tableView.tsx b/static/app/views/eventsV2/table/tableView.tsx index 74f6a53715b900..6479d52d07fbad 100644 --- a/static/app/views/eventsV2/table/tableView.tsx +++ b/static/app/views/eventsV2/table/tableView.tsx @@ -359,7 +359,7 @@ class TableView extends React.Component { handleCellAction = (dataRow: TableDataRow, column: TableColumn) => { return (action: Actions, value: React.ReactText) => { - const {eventView, organization, projects} = this.props; + const {eventView, organization, projects, location} = this.props; const query = new MutableSearch(eventView.query); @@ -431,7 +431,10 @@ class TableView extends React.Component { } nextView.query = query.formatString(); - browserHistory.push(nextView.getResultsViewUrlTarget(organization.slug)); + const target = nextView.getResultsViewUrlTarget(organization.slug); + // Get yAxis from location + target.query.yAxis = decodeList(location.query.yAxis); + browserHistory.push(target); }; }; diff --git a/tests/js/spec/views/eventsV2/table/tableView.spec.jsx b/tests/js/spec/views/eventsV2/table/tableView.spec.jsx index 0e6531de2b566c..8019e50f8e9099 100644 --- a/tests/js/spec/views/eventsV2/table/tableView.spec.jsx +++ b/tests/js/spec/views/eventsV2/table/tableView.spec.jsx @@ -138,6 +138,21 @@ describe('TableView > CellActions', function () { }); }); + it('handles add cell action with multiple y axis', function () { + location.query.yAxis = ['count()', 'failure_count()']; + const wrapper = makeWrapper(initialData, rows, eventView); + const menu = openContextMenu(wrapper, 0); + menu.find('button[data-test-id="add-to-filter"]').simulate('click'); + + expect(browserHistory.push).toHaveBeenCalledWith({ + pathname: location.pathname, + query: expect.objectContaining({ + query: 'title:"some title"', + yAxis: ['count()', 'failure_count()'], + }), + }); + }); + it('handles exclude cell action on string value', function () { const wrapper = makeWrapper(initialData, rows, eventView); const menu = openContextMenu(wrapper, 0);