Skip to content

Commit

Permalink
enhance: use empty prototype object (#4099)
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi authored Feb 20, 2025
1 parent 1ee8ebe commit 975f991
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/_internal/utils/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export const initCache = <Data = any>(

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

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

const subscriptions: Record<string, ((current: any, prev: any) => void)[]> =
{}
Object.create(null)
const subscribe = (
key: string,
callback: (current: any, prev: any) => void
Expand All @@ -73,9 +73,9 @@ export const initCache = <Data = any>(
// Update the state if it's new, or if the provider has been extended.
SWRGlobalState.set(provider, [
EVENT_REVALIDATORS,
{},
{},
{},
Object.create(null),
Object.create(null),
Object.create(null),
mutate,
setter,
subscribe
Expand Down

0 comments on commit 975f991

Please sign in to comment.