Skip to content

Commit

Permalink
[Search Sessions][Dashboard] Clear search session when navigating fro…
Browse files Browse the repository at this point in the history
…m dashboard route (#89749)
  • Loading branch information
Dosant authored Feb 1, 2021
1 parent 4f43096 commit c2f53a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plugins/dashboard/public/application/dashboard_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ export function DashboardApp({
};
}, [dashboardStateManager, dashboardContainer, onAppLeave, embeddable]);

// clear search session when leaving dashboard route
useEffect(() => {
return () => {
data.search.session.clear();
};
}, [data.search.session]);

return (
<div className="app-container dshAppContainer">
{savedDashboard && dashboardStateManager && dashboardContainer && viewMode && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
// should leave session state untouched
await PageObjects.dashboard.switchToEditMode();
await searchSessions.expectState('restored');

// navigating to a listing page clears the session
await PageObjects.dashboard.gotoDashboardLandingPage();
await searchSessions.missingOrFail();
});
});
}

0 comments on commit c2f53a9

Please sign in to comment.