Skip to content

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

@ian4uia

Description

@ian4uia

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions