Optimize table loading (#866)
* wip * wip * Ok * Deleted unused code * Fixed lint * Minor fixes * Minor fixes * Minor Fixes * Minor merge fixes * Ok * Fix storybook tests * Removed console.log * Fix login * asd * Fixed storybook * Added await * Fixed await * Added sleep for failing test * Fix sleep * Fix test * Fix tests --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -1,26 +0,0 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
import usePrevious from '~/hooks/usePrevious';
|
||||
|
||||
import { useEventTracker } from './useEventTracker';
|
||||
|
||||
export function useTrackPageView() {
|
||||
const location = useLocation();
|
||||
const previousLocation = usePrevious(location);
|
||||
const eventTracker = useEventTracker();
|
||||
|
||||
useEffect(() => {
|
||||
// Avoid lot of pageview events enven if the location is the same
|
||||
if (
|
||||
!previousLocation?.pathname ||
|
||||
previousLocation?.pathname !== location.pathname
|
||||
) {
|
||||
eventTracker('pageview', {
|
||||
location: {
|
||||
pathname: location.pathname,
|
||||
},
|
||||
});
|
||||
}
|
||||
}, [location, eventTracker, previousLocation?.pathname]);
|
||||
}
|
||||
Reference in New Issue
Block a user