fix: disable client-side <Head>component until perf issue is fixed (#3255)
Need to look at it in more detail tomorrow.
This commit is contained in:
@@ -37,53 +37,56 @@ options.vnode = (vnode) => {
|
|||||||
case "base":
|
case "base":
|
||||||
case "noscript":
|
case "noscript":
|
||||||
case "template":
|
case "template":
|
||||||
// deno-lint-ignore no-explicit-any
|
// deno-lint-ignore no-constant-condition
|
||||||
vnode.type = (props: any) => {
|
if (false) {
|
||||||
useEffect(() => {
|
// deno-lint-ignore no-explicit-any
|
||||||
const text = renderToString(h(Fragment, null, props.children));
|
vnode.type = (props: any) => {
|
||||||
|
useEffect(() => {
|
||||||
|
const text = renderToString(h(Fragment, null, props.children));
|
||||||
|
|
||||||
if (originalType === "title") {
|
if (originalType === "title") {
|
||||||
document.title = text;
|
document.title = text;
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
let matched: HTMLElement | null = null;
|
|
||||||
if (vnode.key) {
|
|
||||||
matched = document.head.querySelector(
|
|
||||||
`head [data-key="${vnode.key}"]`,
|
|
||||||
) as HTMLElement ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matched === null && props.id) {
|
|
||||||
matched = document.head.querySelector(
|
|
||||||
`#${props.name}`,
|
|
||||||
) as HTMLElement ??
|
|
||||||
null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (matched === null) {
|
|
||||||
if (originalType === "meta") {
|
|
||||||
matched = document.head.querySelector(
|
|
||||||
`head [name="${props.name}"]`,
|
|
||||||
) as HTMLElement ?? null;
|
|
||||||
} else if (originalType === "base") {
|
|
||||||
matched = document.head.querySelector(originalType) ?? null;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (matched === null) {
|
let matched: HTMLElement | null = null;
|
||||||
matched = document.createElement(originalType);
|
if (vnode.key) {
|
||||||
}
|
matched = document.head.querySelector(
|
||||||
|
`head [data-key="${vnode.key}"]`,
|
||||||
|
) as HTMLElement ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
if (matched.textContent !== text) {
|
if (matched === null && props.id) {
|
||||||
matched.textContent = text;
|
matched = document.head.querySelector(
|
||||||
}
|
`#${props.name}`,
|
||||||
|
) as HTMLElement ??
|
||||||
|
null;
|
||||||
|
}
|
||||||
|
|
||||||
applyProps(props, matched);
|
if (matched === null) {
|
||||||
}, []);
|
if (originalType === "meta") {
|
||||||
|
matched = document.head.querySelector(
|
||||||
|
`head [name="${props.name}"]`,
|
||||||
|
) as HTMLElement ?? null;
|
||||||
|
} else if (originalType === "base") {
|
||||||
|
matched = document.head.querySelector(originalType) ?? null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
if (matched === null) {
|
||||||
};
|
matched = document.createElement(originalType as string);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matched.textContent !== text) {
|
||||||
|
matched.textContent = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyProps(props, matched);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ Deno.test("Head - ssr - merge keyed", async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({
|
Deno.test({
|
||||||
|
ignore: true, // Temporarily until client perf is fixed
|
||||||
name: "Head - client - set title",
|
name: "Head - client - set title",
|
||||||
fn: async () => {
|
fn: async () => {
|
||||||
const applyCache = await buildProd({
|
const applyCache = await buildProd({
|
||||||
@@ -181,6 +182,7 @@ Deno.test({
|
|||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({
|
Deno.test({
|
||||||
|
ignore: true, // Temporarily until client perf is fixed
|
||||||
name: "Head - client - match meta",
|
name: "Head - client - match meta",
|
||||||
fn: async () => {
|
fn: async () => {
|
||||||
const applyCache = await buildProd({
|
const applyCache = await buildProd({
|
||||||
@@ -225,6 +227,7 @@ Deno.test({
|
|||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({
|
Deno.test({
|
||||||
|
ignore: true, // Temporarily until client perf is fixed
|
||||||
name: "Head - client - match style by id",
|
name: "Head - client - match style by id",
|
||||||
fn: async () => {
|
fn: async () => {
|
||||||
const applyCache = await buildProd({
|
const applyCache = await buildProd({
|
||||||
@@ -269,6 +272,7 @@ Deno.test({
|
|||||||
});
|
});
|
||||||
|
|
||||||
Deno.test({
|
Deno.test({
|
||||||
|
ignore: true, // Temporarily until client perf is fixed
|
||||||
name: "Head - client - match key",
|
name: "Head - client - match key",
|
||||||
fn: async () => {
|
fn: async () => {
|
||||||
const applyCache = await buildProd({
|
const applyCache = await buildProd({
|
||||||
|
|||||||
Reference in New Issue
Block a user