-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
Description
Describe the bug
When I navigate away from a page with useRouteParams and navigating back via the browsers back button the route param looses reactivity somehow.
This does not work
<script setup lang="ts">
const foo = useRouteParams('foo', '', { transform: String })
const { data, status } = await useAsyncData(`some-key:${foo.value}`, () =>
GqlSomeFetch({
foo: foo.value,
}),
)
</script>
<template>
<UButton to="some-route" label="Some Route" />
</template>
This works:
const route = useRoute()
const foo = computed(() => route.params.foo as string)
Reproduction
WIP
System Info
WIPUsed Package Manager
pnpm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a VueUse issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion.
- The provided reproduction is a minimal reproducible example of the bug.