diff --git a/src/app/loading.tsx b/src/app/loading.tsx
deleted file mode 100644
index b5d9a4f0..00000000
--- a/src/app/loading.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-export default function Loading() {
- return (
-
- )
-}
diff --git a/src/hooks/useCookie.ts b/src/hooks/useCookie.ts
index 89bbe0e7..888ed700 100644
--- a/src/hooks/useCookie.ts
+++ b/src/hooks/useCookie.ts
@@ -1,5 +1,5 @@
'use client'
-import { useState, useEffect } from 'react'
+import { useState, useEffect, useCallback } from 'react'
const useCookie = (cookieName: string): [string, (value: string, expirationDate: string) => void, () => void] => {
const [cookieValue, setCookieValue] = useState('')
@@ -10,15 +10,18 @@ const useCookie = (cookieName: string): [string, (value: string, expirationDate:
setCookieValue(cookie ? cookie.split('=')[1] : '')
}, [cookieName])
- const setCookie = (value: string, expirationDate: string): void => {
- document.cookie = `${cookieName}=${value}; expires=${new Date(expirationDate).toUTCString()}; path=/`
- setCookieValue(value)
- }
+ const setCookie = useCallback(
+ (value: string, expirationDate: string): void => {
+ document.cookie = `${cookieName}=${value}; expires=${new Date(expirationDate).toUTCString()}; path=/`
+ setCookieValue(value)
+ },
+ [cookieName]
+ )
- const deleteCookie = (): void => {
+ const deleteCookie = useCallback((): void => {
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`
setCookieValue('')
- }
+ }, [cookieName])
return [cookieValue, setCookie, deleteCookie]
}
diff --git a/src/services/community-timeline.ts b/src/services/community-timeline.ts
index 6b0a8692..bde1dfe7 100644
--- a/src/services/community-timeline.ts
+++ b/src/services/community-timeline.ts
@@ -155,6 +155,7 @@ export function useGetTimelinePosts() {
const state = useQuery({
queryKey: ['timelinePosts'],
queryFn: () => getAllTimelinePosts(cookieValue),
+ enabled: !!cookieValue,
})
let errorMessage = null