Changelog
Unreleased
Fixed
<Helmet>unmount now restores the prior title / description / keywords / image. The pre-mount snapshot is now a shallow clone ofgetMetaData()rather than a live reference to@mongez/dom’s mutablecurrentMetaDatasingleton, so cleanup actually reads the pre-mount values. Seesrc/components/Helmet.tsx:36.htmlAttributescleanup now removes keys added by the render. Cleanup now diffs the live<html>attribute set against the pre-mount snapshot (excludingdir/lang, which we intentionally leave alone) and removes any attribute the render introduced before re-applying the snapshot. Seesrc/components/Helmet.tsx:120-149.url={false}no longer crashes the canonical-url effect. The component now short-circuits whenpageUrlisfalse,null, or"", treating those as “do not touch the canonical url for this page” — matching the existingHelmetProps.url: boolean | stringtype. Seesrc/components/Helmet.tsx:213-216.@mongez/dom’ssetCanonicalUrlnow writes to theurlslot instead ofcolor. Fix landed in@mongez/dom;getMetaData("url")returns the value that was last set, and the Helmet canonical-url cleanup path can now read back the correct prior value. See../dom/src/metadata.ts:275.- Module-level
document.documentElementaccess no longer throws on the server. Replaced the top-levelconst documentElement = document.documentElementwith a lazygetDocumentElement()helper that returnsnullwhendocumentis undefined. Every call site now null-checks; effects only run on the client, so the null branch is dead code in practice — the change exists purely to keep import-time evaluation pure for SSR. Seesrc/components/Helmet.tsx:19-22.
Added
- First-pass test suite — 42 happy-dom +
@testing-library/reacttests asserting real DOM output (document.title,document.head.querySelector('meta[...]'),<html>attribute / id / class state). vitest.config.ts— happy-dom environment,@vitejs/plugin-react, and a self-detecting sibling alias that resolves@mongez/domfrom the local monorepo when present and falls back tonode_modulesin CI checkouts.- CI —
.github/workflows/test.ymlrunning Node 18/20/22 on Ubuntu, Node 20 on Windows, and a React 19 cross-test on Node 20. - AI kit —
llms.txt,llms-full.txt, andskills/(README,overview,helmet,metadata,configuration,recipes). package.jsonhygiene —sideEffects: false, expandeddescription, broaderkeywords,react >= 18listed as a peer, dev dependencies for the test infra.
Changed
- Documentation —
README.mdrewritten to match the marketing-style format used across the rest of the@mongez/*family: tagline, install, 30-second tour, props reference, configuration, examples, related packages, limitations.
Removed
- Nothing removed; the public API surface is unchanged.
Tests
42 tests passing, 0 skipped