[BUG] wrong return type of `useOne`
Describe the bug
The type of data in the following code is GetOneResponse<BaseRecord>, but actually it should not be
import { useOne } from "@refinedev/core";
const { data } = useOne();`
Now the typings say that data has another entry with key data inside. This is not true.
Steps To Reproduce
- Use
useOne - The typing is wrong:
ReturnType<typeof useOne<T>>['data']isTin reality and notGetOneResponse<T>as indicated by the typing
Expected behavior
ReturnType<typeof useOne<T>>['data'] should be T
Packages
- @refinedev/core
Additional Context
Hey @gbegher thanks for taking time to create issue. GetOneResponse is not wrong, it's correct. However, I understand that having double data data may be confusing. This is something we are improving and will remove in the next major version.
Edit: It seems the issue was caused by an incorrect implementation of our data provider.
@gbegher Can you provide a reproducible example? Because I couldn't reproduce it myself.
@BatuhanW Please accept my deepest apologies.
I did a check on our codebase: Our data provider is not implemented correctly and does not return the correct format.
@gbegher no worries. This is a very confusing return type, and we'll fix it in the next major version.