Skip to content

Commit

Permalink
fix: triggerRef in the update selected function
Browse files Browse the repository at this point in the history
  • Loading branch information
Hebilicious committed Sep 25, 2024
1 parent 7b8a100 commit f2a9a5f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/xstate-vue/src/useSelector.ts
Original file line number Diff line number Diff line change
@@ -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<T>(a: T, b: T) {
Expand Down Expand Up @@ -27,7 +27,9 @@ export function useSelector<
const updateSelectedIfChanged = (nextSelected: T) => {
if (!compare(selected.value, nextSelected)) {
selected.value = nextSelected;
}
} else {
triggerRef(selected)
}
};

watch(
Expand Down

0 comments on commit f2a9a5f

Please sign in to comment.