question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

rc.12 useLazyAsyncData refresh() hangs when called during script setup on subsequent page visit

See original GitHub issue

Environment


  • 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

  1. Clone issue repo
git clone https://github.com/ian4uia/nuxt3rc12-datafetch
  1. Install app
cd nuxt3rc12-datafetch
yarn install
  1. Run dev server
yarn run dev
  1. Go to localhost:3000. The page fetches a random dog image.
  2. Click on the page 2 link to open the second page.
  3. Now click on the ‘Go Back’ button to return to the main page.
  4. 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:open
  • Created a year ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

1reaction
Himanshu21gitcommented, Nov 17, 2022

@ian4uia This bug has been fixed in the nuxt v3.0.0-rc.14 update.

1reaction
jguptacommented, Oct 21, 2022

This seems like a bug related with cache. { initialCache: false } seems to fix this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found