From 4e944294a400086ea2c997d6b60c05549b21ed16 Mon Sep 17 00:00:00 2001 From: ErfanBagheri404 Date: Mon, 17 Aug 2026 11:59:11 +0330 Subject: [PATCH] fix(animated): use WeakMap cache in createHost to avoid writing to components MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Isolate PR #2558 onto next — single commit. # Conflicts: # packages/animated/src/createHost.test.ts # packages/animated/src/createHost.ts --- packages/animated/src/createHost.test.ts | 1 + packages/animated/src/createHost.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/animated/src/createHost.test.ts b/packages/animated/src/createHost.test.ts index e38218657a..d6c1939e90 100644 --- a/packages/animated/src/createHost.test.ts +++ b/packages/animated/src/createHost.test.ts @@ -57,6 +57,7 @@ describe('createHost', () => { const { animated } = createHost({ NamedComponent }, hostConfig) const A = animated(NamedComponent) + expect(A.displayName).toBe('Animated(NamedComponent)') }) diff --git a/packages/animated/src/createHost.ts b/packages/animated/src/createHost.ts index a214ce4921..7a518d5645 100644 --- a/packages/animated/src/createHost.ts +++ b/packages/animated/src/createHost.ts @@ -19,7 +19,7 @@ type WithAnimated = { [key: string]: any } -// For storing the animated version on the original component +/** Module-level cache so animated wrappers survive across createHost calls */ const cacheKey = Symbol.for('AnimatedComponent') // Fallback cache for component objects that are non-extensible (e.g. React