1- import React , { useEffect , useMemo , useState } from 'react' ;
1+ import { useEffect , useMemo , useState } from 'react' ;
22import { LoaderFunction , useLoaderData } from 'react-router' ;
33import parseCmsContent , { CMS_COMPONENT_MAP } from './parseCmsContent' ;
44import OutletWithLoading from './OutletWithLoading' ;
55import NavigationBar from './NavigationBar' ;
6- import { ScriptTag } from './parsePageContent' ;
76import { PageLoadingIndicator } from '@neinteractiveliterature/litform' ;
8- import { Helmet } from 'react-helmet-async' ;
97import { client } from './useIntercodeApolloClient' ;
108import { AppRootLayoutQueryData , AppRootLayoutQueryDocument } from './appRootQueries.generated' ;
119
@@ -48,25 +46,6 @@ function AppRootLayout() {
4846 } ) ;
4947 } , [ data . cmsParentByRequestHost . effectiveCmsLayout . content_html ] ) ;
5048
51- const [ headComponentsWithoutScriptTags , headScriptTags ] = useMemo ( ( ) => {
52- if ( parsedCmsContent ?. headComponents == null ) {
53- return [ [ ] , [ ] ] ;
54- }
55-
56- const nonScriptTags : React . ReactNode [ ] = [ ] ;
57- const scriptTags : React . ReactNode [ ] = [ ] ;
58-
59- React . Children . forEach ( parsedCmsContent . headComponents , ( child ) => {
60- if ( React . isValidElement ( child ) && child . type === ScriptTag ) {
61- scriptTags . push ( child ) ;
62- } else {
63- nonScriptTags . push ( child ) ;
64- }
65- } ) ;
66-
67- return [ nonScriptTags , scriptTags ] ;
68- } , [ parsedCmsContent ?. headComponents ] ) ;
69-
7049 useEffect ( ( ) => {
7150 if ( cachedCmsLayoutId !== data . cmsParentByRequestHost . effectiveCmsLayout . id ) {
7251 if ( cachedCmsLayoutId ) {
@@ -89,9 +68,8 @@ function AppRootLayout() {
8968
9069 return (
9170 < >
92- < Helmet > { headComponentsWithoutScriptTags } </ Helmet >
93- { headScriptTags }
94- { parsedCmsContent ?. bodyComponents }
71+ { parsedCmsContent . headComponents }
72+ { parsedCmsContent . bodyComponents }
9573 </ >
9674 ) ;
9775}
0 commit comments