Skip to content

Commit cb6f8ca

Browse files
Merge pull request #243 from melnikov-s/use-weak-map-for-react
2 parents 325499c + e41b8b1 commit cb6f8ca

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

.changeset/breezy-ants-trade.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@preact/signals-react": patch
3+
---
4+
5+
Replace `Map` useage with `WeakMap`

packages/react/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export { signal, computed, batch, effect, Signal, type ReadonlySignal };
2424
const Empty = [] as const;
2525
const ReactElemType = Symbol.for("react.element"); // https://github.com/facebook/react/blob/346c7d4c43a0717302d446da9e7423a8e28d8996/packages/shared/ReactSymbols.js#L15
2626
const ReactMemoType = Symbol.for("react.memo"); // https://github.com/facebook/react/blob/346c7d4c43a0717302d446da9e7423a8e28d8996/packages/shared/ReactSymbols.js#L30
27-
const ProxyInstance = new Map<FunctionComponent<any>, FunctionComponent<any>>();
27+
const ProxyInstance = new WeakMap<FunctionComponent<any>, FunctionComponent<any>>();
2828
const SupportsProxy = typeof Proxy === "function";
2929

3030
const ProxyHandlers = {

0 commit comments

Comments
 (0)