diff --git a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx index 089db47c367a622..55f1282ea6b912e 100644 --- a/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx +++ b/src/plugins/discover/public/application/main/components/top_nav/discover_topnav.tsx @@ -200,10 +200,16 @@ export const DiscoverTopNav = ({ ]); useEffect(() => { - console.log('time field', dataView?.getTimeField()?.spec.name); saveLsIndex(dataView?.getIndexPattern() || null); saveLsIndexTimeField(dataView?.getTimeField()?.spec.name || null); saveLsDataViewId(dataView?.id); + + return () => { + saveLsIndex(null); + saveLsIndexTimeField(null); + saveLsDataViewId(null); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps }, [dataView]); const savedSearchId = useSavedSearch().id;