Skip to content

Commit 92d4caf

Browse files
committed
fix(shared): ensure invokeArrayFns handles undefined arguments
1 parent c0c9432 commit 92d4caf

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/runtime-core/__tests__/apiLifecycle.spec.ts

+2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ describe('api: lifecycle hooks', () => {
4040
}
4141
render(h(Comp), root)
4242
expect(fn).toHaveBeenCalledTimes(1)
43+
// #10863
44+
expect(fn).toHaveBeenCalledWith()
4345
})
4446

4547
it('onMounted', () => {

packages/shared/src/general.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export const hasChanged = (value: any, oldValue: any): boolean =>
135135

136136
export const invokeArrayFns = (fns: Function[], arg?: any) => {
137137
for (let i = 0; i < fns.length; i++) {
138-
fns[i](arg)
138+
arg === undefined ? fns[i]() : fns[i](arg)
139139
}
140140
}
141141

0 commit comments

Comments
 (0)