diff --git a/packages/xstate-vue/src/useSelector.ts b/packages/xstate-vue/src/useSelector.ts index 2e76b61b27..80b0ec75e7 100644 --- a/packages/xstate-vue/src/useSelector.ts +++ b/packages/xstate-vue/src/useSelector.ts @@ -1,4 +1,4 @@ -import { Ref, isRef, shallowRef, watch } from 'vue'; +import { Ref, isRef, shallowRef, triggerRef, watch } from 'vue'; import { AnyActorRef } from 'xstate'; function defaultCompare(a: T, b: T) { @@ -27,7 +27,9 @@ export function useSelector< const updateSelectedIfChanged = (nextSelected: T) => { if (!compare(selected.value, nextSelected)) { selected.value = nextSelected; - } + } else { + triggerRef(selected) + } }; watch(