-
-
Notifications
You must be signed in to change notification settings - Fork 245
Watch of props not activated #1024
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
Comments
I can confirm that using |
Not destructuring the props actually works; import { watch } from 'nativescript-vue';
const props = defineProps({
text: String,
});
watch(
() => props.text,
() => {
console.log("This watch should activate but it doesn't", props.text);
}
); |
@heywhy I have noticed this in some components, I have some others that do not work like this either, I do not understand why in some it does and in others it does not |
In Vue 3 docs says:
You can use
const props = defineProps({
text: String,
});
const { text } = toRefs(props)
watch(
() =>text,
() => {
console.log("This watch should activate, text);
}
); |
I'm also facing this same issue. watch is not being called even though props are getting changed and the latest value is being displayed in the UI but not calling watch. |
@meghraj-suthar can you show your code? It seems like the problem is decomposing the props, but it's not an NS-Vue problem, it seems to be vue's behavior. Check this comment #1024 (comment) |
Maybe this can help. |
When you declare a wath of a prop in a child component the event is not fired: Preview NS, Playground Vue3. You can see how the Details.vue watch is fired in vue but in NS-vue the event is never fired
The text was updated successfully, but these errors were encountered: