Remove unused pathname hook
This commit is contained in:
parent
b9c31153f2
commit
e114343d1f
@ -18,7 +18,6 @@ import { SWRKey } from '@/swr';
|
||||
|
||||
export type AppStateContextType = {
|
||||
// CORE
|
||||
previousPathname?: string
|
||||
hasLoaded?: boolean
|
||||
hasLoadedWithAnimations?: boolean
|
||||
invalidateSwr?: (key?: SWRKey, revalidate?: boolean) => void
|
||||
|
||||
@ -9,7 +9,6 @@ import {
|
||||
} from 'react';
|
||||
import { AppStateContext } from '../app/AppState';
|
||||
import { AnimationConfig } from '@/components/AnimateItems';
|
||||
import usePathnames from '@/utility/usePathnames';
|
||||
import { getAuthAction } from '@/auth/actions';
|
||||
import useSWR, { useSWRConfig } from 'swr';
|
||||
import {
|
||||
@ -53,8 +52,6 @@ export default function AppStateProvider({
|
||||
|
||||
const pathname = usePathname();
|
||||
|
||||
const { previousPathname } = usePathnames();
|
||||
|
||||
// CORE
|
||||
const [hasLoaded, setHasLoaded] =
|
||||
useState(false);
|
||||
@ -222,7 +219,6 @@ export default function AppStateProvider({
|
||||
<AppStateContext.Provider
|
||||
value={{
|
||||
// CORE
|
||||
previousPathname,
|
||||
hasLoaded,
|
||||
hasLoadedWithAnimations,
|
||||
invalidateSwr,
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { usePathname } from 'next/navigation';
|
||||
|
||||
const usePathnames = () => {
|
||||
const pathname = usePathname();
|
||||
|
||||
const currentRef = useRef('');
|
||||
const previousRef = useRef('');
|
||||
|
||||
useEffect(() => {
|
||||
previousRef.current = currentRef.current;
|
||||
currentRef.current = pathname;
|
||||
}, [pathname]);
|
||||
|
||||
return {
|
||||
currentPathname: currentRef.current,
|
||||
previousPathname: previousRef.current,
|
||||
};
|
||||
};
|
||||
|
||||
export default usePathnames;
|
||||
Loading…
Reference in New Issue
Block a user