@@ -17,7 +17,6 @@ import { channels } from "api/hooks/channels"
17
17
import { testimonials } from "api/hooks/testimonials"
18
18
import handleNotFound from "@/common/handleNotFound"
19
19
import type { PageParams } from "@/app/types"
20
- // import { facetNames } from "@/app-pages/SearchPage/searchPageConfig"
21
20
import getSearchParams from "@/page-components/SearchDisplay/getSearchParams"
22
21
import {
23
22
getConstantSearchParams ,
@@ -60,16 +59,18 @@ const Page: React.FC = async ({
60
59
61
60
const { queryClient } = await prefetch ( [
62
61
learningResources . offerors ( { } ) ,
63
- learningResources . featured ( {
64
- limit : 12 ,
65
- offered_by : [ name ] ,
66
- } ) ,
67
- testimonials . list ( { offerors : [ name ] } ) ,
68
- channels . detailByType ( "unit" , name ) ,
62
+ channelType === ChannelTypeEnum . Unit &&
63
+ learningResources . featured ( {
64
+ limit : 12 ,
65
+ offered_by : [ name ] ,
66
+ } ) ,
67
+ channelType === ChannelTypeEnum . Unit &&
68
+ testimonials . list ( { offerors : [ name ] } ) ,
69
+ channels . detailByType ( channelType , name ) ,
69
70
] )
70
71
71
- const unitChannel = queryClient . getQueryData < UnitChannel > (
72
- channels . detailByType ( "unit" , name ) . queryKey ,
72
+ const channel = queryClient . getQueryData < UnitChannel > (
73
+ channels . detailByType ( channelType , name ) . queryKey ,
73
74
)
74
75
const offerors = queryClient
75
76
. getQueryData < PaginatedLearningResourceOfferorDetailList > (
@@ -83,9 +84,7 @@ const Page: React.FC = async ({
83
84
[ ] ,
84
85
)
85
86
86
- const constantSearchParams = getConstantSearchParams (
87
- unitChannel ?. search_filter ,
88
- )
87
+ const constantSearchParams = getConstantSearchParams ( channel ?. search_filter )
89
88
90
89
const { facetNames } = getFacets (
91
90
channelType ,
@@ -115,7 +114,6 @@ const Page: React.FC = async ({
115
114
[ learningResources . search ( searchRequest as LRSearchRequest ) ] ,
116
115
queryClient ,
117
116
)
118
-
119
117
return (
120
118
< Hydrate state = { dehydratedState } >
121
119
< ChannelPage />
0 commit comments