Skip to content

Commit 2807b3b

Browse files
committed
fix(docs): make Root non-reactive
1 parent e0f764c commit 2807b3b

File tree

1 file changed

+9
-25
lines changed

1 file changed

+9
-25
lines changed

packages/docs/src/root.tsx

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { component$, useContextProvider, useStore } from '@qwik.dev/core';
1+
import { component$, untrack, useContextProvider, useStore } from '@qwik.dev/core';
22
import { Insights } from '@qwik.dev/core/insights';
33
import {
4+
DocumentHeadTags,
45
RouterOutlet,
5-
ServiceWorkerRegister,
66
useDocumentHead,
77
useLocation,
88
useQwikRouter,
@@ -52,6 +52,7 @@ export default component$(() => {
5252
useQwikRouter();
5353
const head = useDocumentHead();
5454
const { url } = useLocation();
55+
const href = head.frontmatter?.canonical || untrack(() => url.href);
5556

5657
const store = useStore<SiteStore>({
5758
headerMenuOpen: false,
@@ -108,9 +109,8 @@ export default component$(() => {
108109
<head>
109110
<meta charset="utf-8" />
110111

111-
<title>{title}</title>
112112
<meta name="description" content={description} />
113-
<link rel="canonical" href={head.frontmatter?.canonical || url.href} />
113+
<link rel="canonical" href={href} />
114114
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
115115
<meta name="apple-mobile-web-app-title" content="Qwik" />
116116
<meta name="application-name" content="Qwik" />
@@ -123,36 +123,20 @@ export default component$(() => {
123123

124124
{import.meta.env.PROD && (
125125
<>
126-
<Social title={title} description={description} href={url.href} ogImage={OGImage.URL} />
126+
<Social title={title} description={description} href={href} ogImage={OGImage.URL} />
127127
<Vendor />
128128
</>
129129
)}
130130

131-
{/* The below are tags that were collected from all the `head` exports in the current route. */}
132-
{head.meta
131+
<DocumentHeadTags
132+
title={title}
133133
// Skip description because that was already added at the top
134-
.filter((s) => s.name !== 'description')
135-
.map((m, key) => (
136-
<meta key={key} {...m} />
137-
))}
138-
139-
{head.links.map((l, key) => (
140-
<link key={key} {...l} />
141-
))}
142-
143-
{head.styles.map((s, key) => (
144-
<style key={key} {...s.props} dangerouslySetInnerHTML={s.style} />
145-
))}
146-
147-
{head.scripts.map((s, key) => (
148-
<script key={key} {...s.props} dangerouslySetInnerHTML={s.script} />
149-
))}
134+
meta={head.meta.filter((s) => s.name !== 'description')}
135+
/>
150136

151137
<InjectThemeScript />
152138
<script dangerouslySetInnerHTML={uwu} />
153139

154-
<ServiceWorkerRegister />
155-
156140
<script dangerouslySetInnerHTML={`(${collectSymbols})()`} />
157141
<Insights />
158142
</head>

0 commit comments

Comments
 (0)