-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
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
Wrong data passed to custom compare function in version 2.0.x #2375
Comments
@fscali Could you provide a CodeSandbox project to reproduce this? |
@fscali Thank you! |
Compare fn is now not only used for comparing data but also other state field (error, isLoading, isValidating). Lines 110 to 125 in ad7bb15
|
I'd like try solve this~ |
Hi, If I undersand well this bug should have been fixed by 2.0.3 but I still get the error in the sandbox I provided.. |
try {
return _.isEqual(
a!.map((val) => val.id),
b!.map((val) => val.id)
);
} catch (_) {
return false;
} Your compare fn is buggy, it does not have the correct behaviour as
|
Thank you @promer94 ...I tried but same error (see same codesandbox). In version 1.3 it works.. |
Bug report
Description / Observed Behavior
When I configure a custom compare function, the parameters that are passed to my function at runtime are booleans instead of the expected custom type
Expected Behavior
The expected behaviour is that my custom compare functions receives the expected type returned by the fetcher.
Repro Steps / Code Example
Additional Context
SWR version: 2.0.1
Framework: Next.js 12.3.1
The text was updated successfully, but these errors were encountered: