Skip to content

Commit ea84ef2

Browse files
authored
Merge branch 'master' into fix-scroll-view-drag
2 parents 61288de + bd38894 commit ea84ef2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/core/src/core/proxy.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,11 +501,19 @@ export default class MpxProxy {
501501
const hooks = this.hooks[hookName] || []
502502
let result
503503
if (isFunction(hook) && !hooksOnly) {
504+
const setContext = hookName !== BEFORECREATE
505+
if (setContext) {
506+
setCurrentInstance(this)
507+
}
504508
result = callWithErrorHandling(hook.bind(this.target), this, `${hookName} hook`, params)
509+
if (setContext) {
510+
unsetCurrentInstance()
511+
}
505512
}
506513
hooks.forEach((hook) => {
507514
result = params ? hook(...params) : hook()
508515
})
516+
509517
return result
510518
}
511519

0 commit comments

Comments
 (0)