Cesar
Repository pattern warning useFetch with Nuxt 3.10
Moreover, using the example of the video, I still have my problems with the warnings :/
I updated the stackblitz to show the problem (on button click)
https://stackblitz.com/edit/github-pgv3r7?file=app.vue
41 replies
Repository pattern warning useFetch with Nuxt 3.10
Hello @manniL / TheAlexLichter
it's me again 🙂
Thank you again for your video, it’s very interesting!
I have a question because in my implementation I also transform the data before returning it. How to do with the implementation so that the returned data is well transformed?
41 replies
Repository pattern warning useFetch with Nuxt 3.10
I tried to update the stackblitz to follow your recommendations but I have 2 problems:
- The first call is made on the client side, with the old way they were made on the server side
- Hydration concerns due to differences
https://stackblitz.com/edit/github-pgv3r7?file=composables%2FuseApiFetch.ts,api%2Fbase.ts,app.vue
Where did I go wrong ?
41 replies
Repository pattern warning useFetch with Nuxt 3.10
The problem is that if I use $fetch in my wrapper, I will no longer have a call that will be made in SSR?
I don't really see how I could use useAsyncData to call the pattern
Really thank you for taking the time to answer me
41 replies
Repository pattern warning useFetch with Nuxt 3.10
Thank you for your feedback, and an additional subscription 😉
Wow
I'm going to have to rethink a lot of things to fix this.
If I understood correctly, when I need to make a call with immediate rendering (SSR) I must go through the useFetch, in all other cases $fetch ?
Would it be okay to pass a boolean to my functions to say to use useFetch or $fetch depending on where the calls are made ?
41 replies
Repository pattern warning useFetch with Nuxt 3.10
Hello !
I made a repro to illustrate (in a very simplified way the problems following the update)
The problem will occurs when you click the button to make another call.
I have this kind of case in my application hundreds of times (whether to apply a filter, to make an API call after an action..)
I also need to keep my wrapper at useFetch to add my token (here I left it empty but it's to show my archi)
Thanks in advance !
https://stackblitz.com/edit/github-pgv3r7?file=app.vue
41 replies