According to the documentation, a return or await needs to be used on navigateTo. When I do this in <script setup> of a page (using await), it doesn't work. But when I remove the await, it works fine. Am I using navigateTo correctly?
#Correct way to use navigateTo
1 messages · Page 1 of 1 (latest)
Here is a code sample:
<template>
<div>
Sending you to the other page
</div>
</template>
<script lang="ts" setup>
await navigateTo('/')
</script>
In this case, the address in the browser bar changes, but the page itself doesn't change. But when using navigateTo without a await, it works as expected.
Works fine in my Nuxt 3. The only way I can make it fail is to add the await navigateTo('/') to the page displayed on the "/" route (which creates an infinite loop)
do you happen to be using supabase
I do not. I was able to recreate this behavior in a new project as well.
I see. I am not creating an infinite redirect loop however
share us a reproduction then via nuxt.new 😋