Use react-query for most viewer queries to get better caching, remove the maxpages on library as that broke scrolling

This commit is contained in:
Jackson Harper
2024-08-14 11:41:55 +08:00
parent 4c992f74ec
commit e16acb7f60
12 changed files with 106 additions and 48 deletions

View File

@ -26,6 +26,7 @@ import {
import useWindowDimensions from '../../lib/hooks/useGetWindowDimensions'
import { useAddItem } from '../../lib/networking/library_items/useLibraryItems'
import { useHandleAddUrl } from '../../lib/hooks/useHandleAddUrl'
import { useGetViewer } from '../../lib/networking/viewer/useGetViewer'
export type NavigationSection =
| 'home'
@ -48,7 +49,7 @@ type NavigationLayoutProps = {
export function NavigationLayout(props: NavigationLayoutProps): JSX.Element {
useApplyLocalTheme()
const { viewerData } = useGetViewerQuery()
const { data: viewerData } = useGetViewer()
const router = useRouter()
const [showLogoutConfirmation, setShowLogoutConfirmation] = useState(false)
const [showKeyboardCommandsModal, setShowKeyboardCommandsModal] =
@ -69,8 +70,10 @@ export function NavigationLayout(props: NavigationLayoutProps): JSX.Element {
// Attempt to identify the user if they are logged in.
useEffect(() => {
setupAnalytics(viewerData?.me)
}, [viewerData?.me])
if (viewerData) {
setupAnalytics(viewerData)
}
}, [viewerData])
const showLogout = useCallback(() => {
setShowLogoutConfirmation(true)