From ff5267c4f1e11c8b30d29823f2e75d04a792b5f1 Mon Sep 17 00:00:00 2001 From: Yixuan Xu Date: Thu, 13 Jul 2023 16:25:55 +0800 Subject: [PATCH] simpilify code --- subscription/src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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.'