Skip to content

feat(next): use react-query #320

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

Merged
merged 4 commits into from
Aug 17, 2022

Conversation

malikalahfaoui
Copy link
Contributor

Q A
Branch? main for features / current stable version branch for bug fixes
Tickets #...
License MIT
Doc PR api-platform/docs#...

const delete{{{ucf}}} = async (id) =>
await fetch(id, { method: "DELETE" });


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Please remove one line.

Comment on lines 28 to 33
const save = useMutation(save{{{ucf}}});
const deleteMutation = useMutation(()=> delete{{{ucf}}}(book["@id"]), {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird to not have consistency for names and mutation function usage.

@alanpoulain
Copy link
Member

It probably lacks the usage of:

  • The <QueryClientProvider> component.
  • The <Hydrate> component.

@dunglas
Copy link
Member

dunglas commented Mar 14, 2022

Why React Query and not SWR... or just nothing?

@alanpoulain
Copy link
Member

@dunglas IMHO, react-query is the preferred fetcher nowadays (and has more features than SWR).
It was your own proposal to use a fetcher: #255, and I think it's a good idea since it has a very good cache system.

@dunglas
Copy link
Member

dunglas commented Mar 14, 2022

Let's use react query then 👍

@malikalahfaoui malikalahfaoui force-pushed the feat/reactQueryNext branch 5 times, most recently from 48354e7 to 0b97ef3 Compare March 20, 2022 23:45
@@ -27,21 +30,22 @@ const Page: NextComponentType<NextPageContext, Props, Props> = (props) => {
</div>
<Show {{{lc}}}={ {{{lc}}} } text={ props.text } />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no props any more and text is not exposed as well from them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This issue is corrected on 319

@alanpoulain alanpoulain force-pushed the feat/reactQueryNext branch 2 times, most recently from e652731 to 3a7f1ac Compare July 4, 2022 19:30
@alanpoulain alanpoulain force-pushed the feat/reactQueryNext branch 4 times, most recently from f488445 to baaf315 Compare July 5, 2022 11:41
@alanpoulain alanpoulain changed the title Feat/react query next feat(next): use react-query Aug 17, 2022
@alanpoulain alanpoulain merged commit 0a78c78 into api-platform:main Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants