@@ -69,41 +69,19 @@ async function buildRenderedPage(req) {
6969async function buildMiniTocItems ( req ) {
7070 const { context } = req
7171 const { page } = context
72- const path = req . pagePath || req . path
7372
7473 // get mini TOC items on articles
7574 if ( ! page . showMiniToc ) {
7675 return
7776 }
7877
79- const miniTocItems = getMiniTocItems ( context . renderedPage , page . miniTocMaxHeadingLevel )
80-
81- // handle special-case prerendered GraphQL objects page
82- if ( path . endsWith ( 'graphql/reference/objects' ) ) {
83- // concat the markdown source miniToc items and the prerendered miniToc items
84- return miniTocItems . concat ( context . graphql . prerenderedObjectsForCurrentVersion . miniToc )
85- }
86-
87- // handle special-case prerendered GraphQL input objects page
88- if ( path . endsWith ( 'graphql/reference/input-objects' ) ) {
89- // concat the markdown source miniToc items and the prerendered miniToc items
90- return miniTocItems . concat ( context . graphql . prerenderedInputObjectsForCurrentVersion . miniToc )
91- }
92-
93- // handle special-case prerendered GraphQL mutations page
94- if ( path . endsWith ( 'graphql/reference/mutations' ) ) {
95- // concat the markdown source miniToc items and the prerendered miniToc items
96- return miniTocItems . concat ( context . graphql . prerenderedMutationsForCurrentVersion . miniToc )
97- }
98-
99- return miniTocItems
78+ return getMiniTocItems ( context . renderedPage , page . miniTocMaxHeadingLevel )
10079}
10180
10281// The avergage size of buildRenderedPage() is about 22KB.
10382// The median in 7KB. By only caching those larger than 10KB we avoid
10483// putting too much into the cache.
10584const wrapRenderedPage = cacheOnReq ( buildRenderedPage , 10 * 1024 )
106- // const wrapMiniTocItems = cacheOnReq(buildMiniTocItems)
10785
10886export default async function renderPage ( req , res , next ) {
10987 const { context } = req
0 commit comments