-
Notifications
You must be signed in to change notification settings - Fork 469
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
vue3 usePage state not updating on props changing #1432
Comments
Someone on discord pointed out, while true Having to use something like this: const time = computed(() => usePage().props.time) vs const page = usePage() // reactive object
const time = computed(() =>page.props.time) the page ref could be made into a reactive object rather then a ref and updates would be reactive without having to use |
I have written and example on how this might be used, this may just work but I don't have an env set up to test using these changes https://gist.github.com/nurdism/cd162c5413de7f38d939ff4cba308b4e this assumes that page object always has |
Linked to discussion in this PR. The |
I've submitted a fix. |
Version:
@inertiajs/vue3
version: 1.0.0Describe the problem:
when using
usePage()
it does not return a ref and there for does not update correctly when the page changesbecause
usePage
is returningpage.value
and not theref
once you reassignpage.value
the old value will not get updated.Example:
this would be solved by returning the ref not the value, but would be a breaking change due to you needing to access page values viaI forgot about reactive objectspage.value
The text was updated successfully, but these errors were encountered: