From 4097c49a8d85f8689aea6c9dbc3ff833814643b7 Mon Sep 17 00:00:00 2001 From: Peter White Date: Mon, 12 Oct 2026 08:38:08 +0200 Subject: [PATCH] Upgrade object-identity and cover cache value types --- bun.lock | 4 ++-- packages/gitbook/package.json | 2 +- packages/gitbook/src/lib/cache.test.ts | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/bun.lock b/bun.lock index b8158ccac..7b2ffc3b3 100644 --- a/bun.lock +++ b/bun.lock @@ -164,7 +164,7 @@ "next-themes": "^0.4.6", "nuqs": "^2.2.3", "object-hash": "^3.0.0", - "object-identity": "^0.1.2", + "object-identity": "^0.2.1", "openapi-types": "^12.1.3", "p-map": "^7.0.3", "p-retry": "^8.0.0", @@ -2677,7 +2677,7 @@ "object-hash": ["object-hash@3.0.0", "", {}, "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw=="], - "object-identity": ["object-identity@0.1.2", "", {}, "sha512-Px5puVllX5L2aBjbcfXpiG5xXeq6OE8RckryTeP2Zq+0PgYrCGJXmC6LblWgknKSJs11Je2W4U2NOWFj3t/QXQ=="], + "object-identity": ["object-identity@0.2.1", "", {}, "sha512-itX2N4m0IvaLhFZMi9YkW4nFML6FshKCCpnn6iKJZVIkCNM/ZRaG4t1bzD2ncaW4r6cHJa59XY+7oZAH7tg8tA=="], "object-inspect": ["object-inspect@1.13.2", "", {}, "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g=="], diff --git a/packages/gitbook/package.json b/packages/gitbook/package.json index b5fadf715..41e0715f4 100644 --- a/packages/gitbook/package.json +++ b/packages/gitbook/package.json @@ -55,7 +55,7 @@ "next-themes": "^0.4.6", "nuqs": "^2.2.3", "object-hash": "^3.0.0", - "object-identity": "^0.1.2", + "object-identity": "^0.2.1", "openapi-types": "^12.1.3", "p-map": "^7.0.3", "p-retry": "^8.0.0", diff --git a/packages/gitbook/src/lib/cache.test.ts b/packages/gitbook/src/lib/cache.test.ts index 4a54f6499..fb155ad4f 100644 --- a/packages/gitbook/src/lib/cache.test.ts +++ b/packages/gitbook/src/lib/cache.test.ts @@ -67,6 +67,17 @@ describe('withStableRef', () => { expect(ref1).not.toBe(ref2); }); + it('should preserve value types in object references', () => { + const toStableRef = withStableRef(); + const numeric = { id: 1 }; + const textual = { id: '1' }; + + expect(toStableRef(numeric)).toBe(numeric); + expect(toStableRef(textual)).toBe(textual); + expect(toStableRef({ id: 1 })).toBe(numeric); + expect(toStableRef({ id: '1' })).toBe(textual); + }); + it('should maintain reference stability across multiple calls', () => { const toStableRef = withStableRef();