diff --git a/subscription/src/index.ts b/subscription/src/index.ts index 2bd5f7b43..3cf77bb6d 100644 --- a/subscription/src/index.ts +++ b/subscription/src/index.ts @@ -26,7 +26,6 @@ export const subscription = ((useSWRNext: SWRHook) => config: SWRConfiguration & typeof SWRConfig.defaultValue ): SWRSubscriptionResponse => { const [key, args] = serialize(_key) - const originKey = args // Prefix the key to avoid conflicts with other SWR resources. const subscriptionKey = key ? SUBSCRIPTION_PREFIX + key : undefined @@ -68,7 +67,7 @@ export const subscription = ((useSWRNext: SWRHook) => subscriptions.set(subscriptionKey, refCount + 1) if (!refCount) { - const dispose = subscribe(originKey, { next }) + const dispose = subscribe(args, { next }) if (typeof dispose !== 'function') { throw new Error( 'The `subscribe` function must return a function to unsubscribe.'