refactor: simplify loader implementation by removing clientLoader and streamlining data fetching

This commit is contained in:
Ardeman
2025-03-19 18:53:30 +08:00
parent b8378d37ad
commit 2dc84c582d
2 changed files with 17 additions and 31 deletions
+2 -4
View File
@@ -4,13 +4,11 @@ import { Card } from '~/components/ui/card'
import { CarouselHero } from '~/components/ui/carousel-hero'
import { CarouselSection } from '~/components/ui/carousel-section'
import { Newsletter } from '~/components/ui/newsletter'
import { type clientLoader } from '~/routes/_news._index'
import { type loader } from '~/routes/_news._index'
import type { TNews } from '~/types/news'
export const NewsPage = () => {
const loaderData = useRouteLoaderData<typeof clientLoader>(
'routes/_news._index',
)
const loaderData = useRouteLoaderData<typeof loader>('routes/_news._index')
const spotlight: TNews = {
title: loaderData?.spotlightCategory?.name || '',
description: loaderData?.spotlightCategory?.description || '',