Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

No auto-generated hooks when using fakeBaseQuery #205

Closed
garrettjoecox opened this issue Apr 16, 2021 · 4 comments
Closed

No auto-generated hooks when using fakeBaseQuery #205

garrettjoecox opened this issue Apr 16, 2021 · 4 comments

Comments

@garrettjoecox
Copy link

Hey there, I'm using the newly added fakeBaseQuery pattern, as we have an already built SDK we are wanting to wrap RTKQ around.

Following the pattern in the fakeBaseQuery tests it doesn't seem the returned value has the auto-generated hooks for the queries added. Is this a design decision, are we stuck with that limitation if we use fakeBaseQuery?

@markerikson
Copy link
Collaborator

What build are you using atm? That stuff isn't even released yet, as far as I know.

Note that in the current next branch, we've split up the exports into separate entry points. rtk-query has the UI-agnostic versions of createApi, while rtk-query/react has the React-specific enhanced versions that actually generate the hooks. Assuming you're using one of the CI-built packages, you probably need to use the React-specific entry point instead.

@msutkowski
Copy link
Member

msutkowski commented Apr 16, 2021

What build are you using atm? That stuff isn't even released yet, as far as I know.

Note that in the current next branch, we've split up the exports into separate entry points. rtk-query has the UI-agnostic versions of createApi, while rtk-query/react has the React-specific enhanced versions that actually generate the hooks. Assuming you're using one of the CI-built packages, you probably need to use the React-specific entry point instead.

@garrettjoecox This is correct. You'll need to import from the react entrypoint 🎉

More specifically:

import { createApi } from '@rtk-incubator/rtk-query/react';
import { fakeBaseQuery } from '@rtk-incubator/rtk-query';

@garrettjoecox
Copy link
Author

Terrific, this solved my issue.

What build are you using atm?

Using the next branch, the only way we'll be able to use RTKQ is with these changes so looking forward to them getting released 😄

@msutkowski
Copy link
Member

msutkowski commented Apr 16, 2021

@garrettjoecox That's awesome! Keep us posted on your experience. We're almost ready to go - just updating the docs and potentially one more small feature will get merged in today.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants