Skip to content

Commit 975f991

Browse files
authored
enhance: use empty prototype object (#4099)
1 parent 1ee8ebe commit 975f991

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/_internal/utils/cache.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ export const initCache = <Data = any>(
4141

4242
// If there's no global state bound to the provider, create a new one with the
4343
// new mutate function.
44-
const EVENT_REVALIDATORS = {}
44+
const EVENT_REVALIDATORS = Object.create(null)
4545

4646
const mutate = internalMutate.bind(UNDEFINED, provider) as ScopedMutator
4747
let unmount = noop
4848

4949
const subscriptions: Record<string, ((current: any, prev: any) => void)[]> =
50-
{}
50+
Object.create(null)
5151
const subscribe = (
5252
key: string,
5353
callback: (current: any, prev: any) => void
@@ -73,9 +73,9 @@ export const initCache = <Data = any>(
7373
// Update the state if it's new, or if the provider has been extended.
7474
SWRGlobalState.set(provider, [
7575
EVENT_REVALIDATORS,
76-
{},
77-
{},
78-
{},
76+
Object.create(null),
77+
Object.create(null),
78+
Object.create(null),
7979
mutate,
8080
setter,
8181
subscribe

0 commit comments

Comments
 (0)