Skip to content

Commit 01cd9cf

Browse files
authored
perf(useMutationObserver): watch ref directly (#4940)
1 parent 930648d commit 01cd9cf

File tree

1 file changed

+4
-4
lines changed
  • packages/core/useMutationObserver

1 file changed

+4
-4
lines changed

packages/core/useMutationObserver/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ export function useMutationObserver(
4343
})
4444

4545
const stopWatch = watch(
46-
() => targets.value,
47-
(targets) => {
46+
targets,
47+
(newTargets) => {
4848
cleanup()
4949

50-
if (isSupported.value && targets.size) {
50+
if (isSupported.value && newTargets.size) {
5151
observer = new MutationObserver(callback)
52-
targets.forEach(el => observer!.observe(el, mutationOptions))
52+
newTargets.forEach(el => observer!.observe(el, mutationOptions))
5353
}
5454
},
5555
{ immediate: true, flush: 'post' },

0 commit comments

Comments
 (0)