rc.12 useLazyAsyncData refresh() hangs when called during script setup on subsequent page visit
See original GitHub issueEnvironment
- Operating System:
Linux
- Node Version:
v16.18.0
- Nuxt Version:
3.0.0-rc.12
- Nitro Version:
0.6.0
- Package Manager:
yarn@1.22.19
- Builder:
vite
- User Config:
buildModules
- Runtime Modules:
-
- Build Modules:
@pinia/nuxt@0.4.3
Reproduction
- Clone issue repo
git clone https://github.com/ian4uia/nuxt3rc12-datafetch
- Install app
cd nuxt3rc12-datafetch
yarn install
- Run dev server
yarn run dev
- Go to localhost:3000. The page fetches a random dog image.
- Click on the page 2 link to open the second page.
- Now click on the ‘Go Back’ button to return to the main page.
- See the bug. The page should refresh the data and show a new image of a dog but it hangs showing the ‘Loading…’ text indefinitely.
Describe the bug
When index.vue is loaded for the first time useLazyAsyncData is run successfully and the data and refresh function are returned. You can test the refresh function using the button to verify this. On subsequent visits to the index page from pages within the app useLazyAsyncData is not run because we already have data. However, we may decide to refresh the data using the refresh function but it doesn’t work in this context. I’ve tested the app with rc11 and it works as expected.
Additional context
No response
Logs
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:4
- Comments:6
Top Results From Across the Web
Nuxt 3 SSR: useFetch() returning null on page refresh
I. When making alterations to the code in app.vue and thus triggering HMR thing will contain the expected data from the API. II....
Read more >Data Fetching · Get Started with Nuxt
This method is useful if you want to refresh all the data fetching for a current page. Read more in Docs > Api...
Read more >Vue 3: Support new <script setup> without ref sugar - YouTrack
When using it with lang='ts' , vue dependencies are not resolved, all appears in red and no autocompletion, whilte the rest of imports...
Read more >The MAGIC of Nuxt v3 useLazyAsyncData (Creating a better ...
The MAGIC of Nuxt v3 useLazyAsyncData (Creating a better app UX). 2.3K views 9 months ago. Kaizen Codes. Kaizen Codes. 2.38K subscribers.
Read more >Vue 3 Script Setup Tutorial - This Changes Everything!
In this video, I'm gonna show everything you need to know to get started with the Script Setup pattern for Vue 3 &...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ian4uia This bug has been fixed in the nuxt v3.0.0-rc.14 update.
This seems like a bug related with cache.
{ initialCache: false }
seems to fix this.