From 72ab873aeff542a5ac6887ceeb0a87ff2f184ea6 Mon Sep 17 00:00:00 2001 From: Sean Alunni <70455845+AFatNiBBa@users.noreply.github.com> Date: Fri, 11 Apr 2025 10:23:46 +0200 Subject: [PATCH 1/3] Fixed #56 --- src/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index bba8268..b1ed144 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -41,8 +41,9 @@ const metaTagProperties: string[] = const getTagKey = (tag: TagDescription, properties: string[]) => { // pick allowed properties and sort them const tagProps = Object.fromEntries( - Object.entries(tag.props) - .filter(([k]) => properties.includes(k)) + properties + .filter(k => k in tag.props) + .map(k => [k, tag.props[k]]) .sort() ); From 844fe520a76cbce46e7b064a174bdad3e74c0747 Mon Sep 17 00:00:00 2001 From: AFatNiBBa Date: Sun, 13 Apr 2025 20:33:14 +0200 Subject: [PATCH 2/3] Added a test for #56 --- test/index.spec.tsx | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/test/index.spec.tsx b/test/index.spec.tsx index 13266ae..8aa10ae 100644 --- a/test/index.spec.tsx +++ b/test/index.spec.tsx @@ -1,5 +1,5 @@ /* @jsxImportSource solid-js */ -import { createSignal, lazy } from "solid-js"; +import { createSignal, getOwner, lazy } from "solid-js"; import { hydrate, render, Show } from "solid-js/web"; import { MetaProvider, Title, Style, Meta, Link, Base } from "../src"; import { hydrationScript, removeScript } from "./hydration_script"; @@ -304,6 +304,30 @@ test("throws error if head tag is rendered without MetaProvider", () => { }).toThrowError(/ should be in the tree/); }); +test("doesn't create any effect on removal", () => { + let div = document.createElement("div"); + + const [ show, setShow ] = createSignal(true); + const showAndTest = () => { + expect(getOwner()?.owner).toBeTruthy(); + return show(); + }; + + const dispose = render( + () => ( + + + Something {showAndTest()} that forces the Solid compiler to create a memo here + + + ), + div + ); + + setShow(false); + dispose(); +}); + test("Escaping the title tag", () => { let div = document.createElement("div"); const snapshot = 'Hello</title><script>alert("inject");</script><title> World'; From b6b6b32c05410c71e03a26664d0c8d55e8344f36 Mon Sep 17 00:00:00 2001 From: Birk Skyum Date: Sun, 13 Apr 2025 21:26:22 +0200 Subject: [PATCH 3/3] add changeset --- .changeset/funny-showers-hope.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/funny-showers-hope.md diff --git a/.changeset/funny-showers-hope.md b/.changeset/funny-showers-hope.md new file mode 100644 index 0000000..8f7260b --- /dev/null +++ b/.changeset/funny-showers-hope.md @@ -0,0 +1,5 @@ +--- +"@solidjs/meta": patch +--- + +fix: Don't read props of the Title component during cleanup