[Nuxt3.0.0-rc.13] UseFetch() when calling multiple request, only the last data is fetched.
See original GitHub issueEnvironment
Nuxi 3.0.0-rc.13
- Operating System:
Darwin
- Node Version:
v16.18.0
- Nuxt Version:
3.0.0-rc.13
- Nitro Version:
0.6.1
- Package Manager:
yarn@1.22.18
- Builder:
vite
- User Config:
ssr
,target
,meta
,css
,plugins
,vite
,build
,modules
,buildModules
,typescript
,components
,vueuse
,publicRuntimeConfig
- Runtime Modules:
@vueuse/nuxt@9.5.0
- Build Modules:
@pinia/nuxt@0.4.3
,unplugin-icons/nuxt
Reproduction
Page L component_1.vue L component_2.vue L conponent_3.vue
component_1 ` onMounted(() => { request(‘firstUrl’) })
const request = async (url:string) => { const { data } = await useFetch(url, options) console.log(data) } `
component_2 ` onMounted(() => { request(‘secondUrl’) })
const request = async (url:string) => { const { data } = await useFetch(url, options) console.log(data) } `
component_3 ` onMounted(() => { request(‘thirdUrl’) })
const request = async (url:string) => { const { data } = await useFetch(url, options) console.log(data) } `
Describe the bug
My pages folder tree
in each component(tabs), Each component requested the following api calls in the onMounted lifecycle.
However, among the above three requests, I found that the data of the last request data goes into each result(component_1, component_2 result).
useFetch() <- not working Async / await ?
you can find my log below,
As I expected, the response value should come right below each url, but the last data comes 3 times after all url have been delivered. (see, logs) what should i do? help me:)
useFetch() can use 3.0.0-rc.8.
Additional context
No response
Logs
orders/usim/delivery/before/1/20
orders/usim/delivery/after/1/20
orders/usim/1/20
Proxy {success: true, data: {…}}[[Handler]]: Object[[Target]]: Objectdata: {list: Array(20), count: 1649}success: true[[Prototype]]: Object[[IsRevoked]]: false
Proxy {success: true, data: {…}}[[Handler]]: Object[[Target]]: Objectdata: {list: Array(20), count: 1649}success: true[[Prototype]]: Object[[IsRevoked]]: false
Proxy {success: true, data: {…}}[[Handler]]: Object[[Target]]: Objectdata: {list: Array(20), count: 1649}success: true[[Prototype]]: Object[[IsRevoked]]: false
Issue Analytics
- State:
- Created 10 months ago
- Comments:5 (2 by maintainers)
Thank you for helping me! I’ll write it up and post it!
Please see the link I posted. I don’t need your project, but I do need a stackblitz that shows the issue.