-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add React Query command #26
Conversation
b135a6e
to
8db2362
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great 👍 Just had a couple of comments and need to fix CI error.
src/commands/reactQuery.ts
Outdated
import prependToFile from '../util/prependToFile'; | ||
|
||
export default async function addReactQuery() { | ||
await addDependency('@tanstack/react-query axios msw'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a check for the individual case when a dependency is already added? I'm wondering if there could be issues when running the addReactQuery
alone in an existing project.
/** | ||
* lines should be separated by newlines | ||
*/ | ||
export default async function appendToFile(filename: string, lines: string) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of having both the addToGitignore
and the appendToFile
to the same fileUtils
file? This would keep the src/util
leaner and keep related utilities together instead of having 1 file per function.
if (error.message) { | ||
error.message = `Mock for ${request.method} ${ | ||
request.url | ||
} was called, but ${message}. Verify that the mocks provided to the test are correct.\n\n${ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice error handling 👍
5dbfbb3
to
bfe868c
Compare
I rebased this branch and force pushed. |
templates/createApp/App.tsx
Outdated
import Providers, { Provider } from 'src/components/Providers'; | ||
import RootNavigator from 'src/navigators/RootNavigator'; | ||
import queryClient from '../reactQuery/src/util/api/queryClient'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import queryClient from '../reactQuery/src/util/api/queryClient'; | |
import queryClient from 'src/util/api/queryClient'; |
I had to change it to this for the App to load the bundler successfully.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this in commit
This command should probably ask the user if they want to use React Query and not automatically install it. |
Hi folks, I'm working on this PR as part of Space Station 🛰️ |
3115eb9
to
2e10182
Compare
@stevehanson Do you mean as part of the standard create app process? The change I'm making right now to make the reactQuery command work independently is to have the |
@codeofdiego yes, as part of |
This follows the template that [we previously coded in react-native-templates](https://github.com/thoughtbot/react-native-templates/pull/1/files#diff-fc130cd2eebfc7cbeb229f509cb090c6fb5837a169b9270709cfa73ff46c9a56). * Installs React Query * Installs testing/mocking utility, MSW * Creates a mocking and testing strategy * Adds an example API call and mock and test For now, the "create" command automatically uses React Query, but we will likely decide to prompt the user if they'd like to use this or Apollo (for GraphQL) in the future. Co-authored-by: Frida Casas <[email protected]>
271cb7d
to
203f439
Compare
I rebased this PR and updated it per the Trello ticket we defined this morning:
New apps currently pull down coffee drinks from an API and display them. We might want to consider a different API and maybe showing results in a separate tab in a follow-up PR. |
Released in 0.6.1. |
This follows the template that we previously coded in react-native-templates.
For now, the "create" command automatically uses React Query, but we will likely decide to prompt the user if they'd like to use this or Apollo (for GraphQL) in the future.