From 46d36552e41696549b2d366e6f53446142da6e8d Mon Sep 17 00:00:00 2001 From: Melissa Ashford Date: Wed, 24 Jun 2026 21:20:53 +0000 Subject: [PATCH] fix: key meta tags by property so og:* tags stop collapsing buildKeyByProps only treated id/name/href/src as unique attributes, so og:* tags (which use property=) fell through to the prop-name fallback and all collided on the same key (meta[property][content]), last-write- wins -> only og:image survived sitewide. Add property to the unique-attr list so each og:* tag keeps a distinct key. Adds a regression test. --- __tests__/manager.tsx | 26 ++++++++++++++++++++++++++ src/manager.ts | 2 +- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/__tests__/manager.tsx b/__tests__/manager.tsx index 92bae39..761cf8b 100644 --- a/__tests__/manager.tsx +++ b/__tests__/manager.tsx @@ -62,4 +62,30 @@ describe('Manager', () => { '', ); }); + + it('should keep og:* meta tags distinct by property (regression: property collapse)', () => { + const manager = new Manager(); + + manager.isServer = true; + + manager.pushTags( + <> + + + + + , + containerId, + ); + + const { meta } = manager.getTags(); + const htmlMeta = renderServerMeta(meta); + const ogCount = (htmlMeta.match(/property="og:/g) ?? []).length; + + expect(ogCount).to.equal(4); + expect(htmlMeta).to.contain('property="og:title"'); + expect(htmlMeta).to.contain('property="og:description"'); + expect(htmlMeta).to.contain('property="og:url"'); + expect(htmlMeta).to.contain('property="og:image"'); + }); }); diff --git a/src/manager.ts b/src/manager.ts index c34e9f9..23dfa99 100644 --- a/src/manager.ts +++ b/src/manager.ts @@ -194,7 +194,7 @@ class Manager { let key = ''; // try to build unique key by unique props - for (const uniqueAttr of ['id', 'name', 'href', 'src']) { + for (const uniqueAttr of ['id', 'name', 'property', 'href', 'src']) { if (props[uniqueAttr]) { key = `[${uniqueAttr}='${props[uniqueAttr] as string}']`;