Remove unused pathname hook
This commit is contained in:
parent
b9c31153f2
commit
e114343d1f
@ -18,7 +18,6 @@ import { SWRKey } from '@/swr';
|
|||||||
|
|
||||||
export type AppStateContextType = {
|
export type AppStateContextType = {
|
||||||
// CORE
|
// CORE
|
||||||
previousPathname?: string
|
|
||||||
hasLoaded?: boolean
|
hasLoaded?: boolean
|
||||||
hasLoadedWithAnimations?: boolean
|
hasLoadedWithAnimations?: boolean
|
||||||
invalidateSwr?: (key?: SWRKey, revalidate?: boolean) => void
|
invalidateSwr?: (key?: SWRKey, revalidate?: boolean) => void
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import {
|
|||||||
} from 'react';
|
} from 'react';
|
||||||
import { AppStateContext } from '../app/AppState';
|
import { AppStateContext } from '../app/AppState';
|
||||||
import { AnimationConfig } from '@/components/AnimateItems';
|
import { AnimationConfig } from '@/components/AnimateItems';
|
||||||
import usePathnames from '@/utility/usePathnames';
|
|
||||||
import { getAuthAction } from '@/auth/actions';
|
import { getAuthAction } from '@/auth/actions';
|
||||||
import useSWR, { useSWRConfig } from 'swr';
|
import useSWR, { useSWRConfig } from 'swr';
|
||||||
import {
|
import {
|
||||||
@ -53,8 +52,6 @@ export default function AppStateProvider({
|
|||||||
|
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
|
||||||
const { previousPathname } = usePathnames();
|
|
||||||
|
|
||||||
// CORE
|
// CORE
|
||||||
const [hasLoaded, setHasLoaded] =
|
const [hasLoaded, setHasLoaded] =
|
||||||
useState(false);
|
useState(false);
|
||||||
@ -222,7 +219,6 @@ export default function AppStateProvider({
|
|||||||
<AppStateContext.Provider
|
<AppStateContext.Provider
|
||||||
value={{
|
value={{
|
||||||
// CORE
|
// CORE
|
||||||
previousPathname,
|
|
||||||
hasLoaded,
|
hasLoaded,
|
||||||
hasLoadedWithAnimations,
|
hasLoadedWithAnimations,
|
||||||
invalidateSwr,
|
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