Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[useFetch] After execute, the isFetching is still true #3602

Closed
7 tasks done
tolking opened this issue Dec 2, 2023 · 0 comments · Fixed by #3603
Closed
7 tasks done

[useFetch] After execute, the isFetching is still true #3602

tolking opened this issue Dec 2, 2023 · 0 comments · Fixed by #3603

Comments

@tolking
Copy link
Contributor

tolking commented Dec 2, 2023

Describe the bug

const { isFetching, isFinished, execute } = useFetch('https://httpbin.org/get', { immediate: false })

async function load() {
  await execute()

  console.log('end', isFetching.value, isFinished.value) // end true false
}

The request has been completed, but the isFetching is still true. This does not seem to be a reasonable behavior.


I found that the problem was caused by useFetch L490, This prevents finally from being executed immediately after then.

The fetch function originally returns a Promise. It seems redundant to wrap fetch with Promise. (I'm not sure why write by this way)

Reproduction

https://play.vueuse.org/#N4IgDghgxg1hDmBTAziAXAbVAOwgW0XRADcBXRAWgBNE8BLEAGhGQHtSAnKQtEU7MDHhMQNZFA50wAFzqtsRAGrkABABFadFQAoAFhAA2AMxV1sKgGIdE2KLoCUp5CogqaxRAdZgz8FaVkDOmkATxcDLwB3ZxD2FWlWFUjJaUQVAFVsOg8OZEMVZTSAGToAIw4ISRQVI1YOAtUAJhUAMhUAZhFOAyJdaWkwZDQAemH+QXgAOihWPGGyShp6YaDS4bMaAA9JvAArVABfRhx8HhAAAQXSZERh5H1rKhE2Tm4icaERMQkpWXkiADKD0QVAaiHSN38gWCdBQky6HB6vD6AyGow+Uxmc0u5Gut3ulRB5wAjAAGSbEyak9bYLY7fYgI4nAhEHGIPHDGbWZ7sLhnDFfFA-GRyBS8ADCrAiiCgf3MrBMKBu2Fk+UKKkleDArGQMPkGWhshQCKRIBRgxGYwEQmms2GbI5XMQJPJlOpG0Q2z2hwAuswjHQDMa0KAAIJgMCTBboUCpLUGCCpIgAHlKAQS5nOUCCsAAvAAdEBeCBUQsAPmLVGTwzT-XkZeewukRDoWrq0hUwH8NwsiGkdhUBxqHFmKgA5A6bpy6ogx-nsPOZthkB2u3RkL3+7pfIwnBYzOvdCDd56ZQE0kPc93EJu7Nox+a0cNzaUzJM6vBhkhpGPd2u8AQVB0ImiBoDUhiQgc9jzvOEDICEtg1PwsqiiolbaI4wDzioLiRBAwQqKeUDnhhMHmCoS5sEGkxePA942FQv57n2di+FGhjkLu677lk9wguxBjkNB2AHPOjIHAcQA

System Info

@vueuse/core: ^10.5.0 => 10.5.0 
vue: ^3.3.6 => 3.3.6

Used Package Manager

npm

Validations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant