diff --git a/static/app/views/issueList/customViewsHeader.spec.tsx b/static/app/views/issueList/customViewsHeader.spec.tsx index 337f7e23b1c385..fc7c9e0fcb95af 100644 --- a/static/app/views/issueList/customViewsHeader.spec.tsx +++ b/static/app/views/issueList/customViewsHeader.spec.tsx @@ -265,6 +265,53 @@ describe('CustomViewsHeader', () => { }) ); }); + + it('updates the unsaved changes indicator for a default tab if the query is different', async () => { + MockApiClient.clearMockResponses(); + MockApiClient.addMockResponse({ + url: `/organizations/${organization.slug}/group-search-views/`, + method: 'GET', + body: [ + { + name: 'Prioritized', + query: 'is:unresolved issue.priority:[high, medium]', + querySort: IssueSortOptions.DATE, + }, + ], + }); + + const defaultTabDifferentQueryRouter = RouterFixture({ + location: LocationFixture({ + pathname: `/organizations/${organization.slug}/issues/`, + query: { + query: 'is:unresolved', + viewId: 'default0', + }, + }), + }); + + render( + , + { + router: defaultTabDifferentQueryRouter, + } + ); + expect(await screen.findByRole('tab', {name: 'Prioritized'})).toBeInTheDocument(); + expect(screen.getByTestId('unsaved-changes-indicator')).toBeInTheDocument(); + expect(screen.queryByRole('tab', {name: 'Unsaved'})).not.toBeInTheDocument(); + + expect(defaultTabDifferentQueryRouter.replace).toHaveBeenCalledWith( + expect.objectContaining({ + query: expect.objectContaining({ + query: 'is:unresolved', + viewId: 'default0', + }), + }) + ); + }); }); describe('CustomViewsHeader query behavior', () => { diff --git a/static/app/views/issueList/customViewsHeader.tsx b/static/app/views/issueList/customViewsHeader.tsx index 71a356e0f02f6e..63803345c49f9f 100644 --- a/static/app/views/issueList/customViewsHeader.tsx +++ b/static/app/views/issueList/customViewsHeader.tsx @@ -162,15 +162,6 @@ function CustomViewsIssueListHeaderTabsContent({ ); const getInitialTabKey = () => { - if (draggableTabs[0].key.startsWith('default')) { - if (query) { - return TEMPORARY_TAB_KEY; - } - return draggableTabs[0].key; - } - if (!query && !sort && !viewId) { - return draggableTabs[0].key; - } if (viewId && draggableTabs.find(tab => tab.id === viewId)) { return draggableTabs.find(tab => tab.id === viewId)!.key; }