Skip to content

Commit

Permalink
fix useEffect unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
walterra committed Apr 2, 2024
1 parent 7db9bd4 commit ede8504
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ede8504

Please sign in to comment.