Skip to content

Basic loader reload #610

Closed Answered by posva
mgksmv asked this question in Questions and Help
Mar 19, 2025 · 2 comments · 13 replies
Discussion options

You must be logged in to vote

So you see a refresh() of the data (based on the slateTime of the data) after 5s which is expected. The default value of staleTime is 5 seconds but it can be made bigger if your data doesn't requires to be considered stale that often:

export const useClientsData = defineColadaLoader('/clients', {
  async query(to) {
    return getClients(to.params);
  },
  key: ['users'],
  staleTime: 30_000,
})

The colada loader does have a mechanism where it will reload if the route changed. Initially I didn't add that behavior to the basic loader but I might add it. Note that useAsyncData() always refetch, it doesn't track the route changes and that you can still data loaders with Nuxt!

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
13 replies
@posva
Comment options

@mgksmv
Comment options

@mgksmv
Comment options

@posva
Comment options

Answer selected by posva
@mgksmv
Comment options

@posva
Comment options

@mgksmv
Comment options

@posva
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants