Skip to content

Commit

Permalink
chore: update
Browse files Browse the repository at this point in the history
  • Loading branch information
linzhe141 committed Dec 18, 2024
1 parent 223bdf2 commit 7c145d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/runtime-core/src/directives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@ export function withDirectives<T extends VNode>(
for (let i = 0; i < directives.length; i++) {
let [dir, value, arg, modifiers = EMPTY_OBJ] = directives[i]
if (dir) {
currentBlock && currentBlock.push(vnode)
if (currentBlock && !currentBlock.find(i => i === vnode)) {
currentBlock.push(vnode)
}
if (isFunction(dir)) {
dir = {
mounted: dir,
Expand Down
2 changes: 1 addition & 1 deletion packages/vue/__tests__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ describe('compiler + runtime integration', () => {
expect(container.innerHTML).toBe(`<div>false<div>true</div></div>`)
})

it('should trigger custom directive unmounted hook with v-for', async () => {
test('should trigger custom directive unmounted hook with v-for', async () => {
const mounted = vi.fn()
const unmounted = vi.fn()
const visible = ref(true)
Expand Down

0 comments on commit 7c145d6

Please sign in to comment.