We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using an array key the key that is passed to the subscribe function is a string and not an array
I expect it to be deconstructed similar to is shown under "Usage" here https://swr.vercel.app/docs/subscription
const key = "a key"; const { data } = useSWRSubscription(["key", key], (passedKey, { next }) => { passedKey === '@"key","a key",' // returns true return () => {}; });
https://codesandbox.io/s/relaxed-silence-h556kz?file=/src/App.js
2.1.2
The text was updated successfully, but these errors were encountered:
we should pass original key here instead of serialized key
swr/subscription/index.ts
Line 67 in bad51f6
Sorry, something went wrong.
I would like to take this issue
Fix vercel#2548: pass origin key to subcription callback
afe4223
Fix #2548: pass origin key to subcription callback (#2550)
af90b11
By the way Could we pass originKey in onError/onSuccess callback? Now it accepts only serialized key, it's terrible.
originKey
onError/onSuccess
@Zheaoli @promer94
Zheaoli
Successfully merging a pull request may close this issue.
Bug report
Description / Observed Behavior
When using an array key the key that is passed to the subscribe function is a string and not an array
Expected Behavior
I expect it to be deconstructed similar to is shown under "Usage" here https://swr.vercel.app/docs/subscription
Repro Steps / Code Example
https://codesandbox.io/s/relaxed-silence-h556kz?file=/src/App.js
Additional Context
2.1.2
The text was updated successfully, but these errors were encountered: