fix(mp): 修复混合分包时报错找不到 $callHook 的问题#5965
Open
chouchouji wants to merge 1 commit intouni-app-vue3-devfrom
Open
Conversation
65b1362 to
a3988f1
Compare
Size report
|
There was a problem hiding this comment.
Pull request overview
This PR targets a Uni Mini Program runtime issue where mixed subpackages can throw an error due to missing $callHook, by making the hook helpers accessible and wiring them into the subpackage app instance context.
Changes:
- Export
hasHookandcallHookfromcomponentInstance.tsso they can be reused externally. - In
initCreateSubpackageApp, attach$hasHook/$callHookontovm.$.ctxto align subpackage app context behavior with the base instance initialization.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/uni-mp-core/src/runtime/componentInstance.ts |
Exports hasHook/callHook so other runtime modules can reference them. |
packages/uni-mp-core/src/runtime/app.ts |
Imports and assigns $hasHook/$callHook to subpackage app VM context to avoid missing-hook errors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
129
to
+131
| ;(vm.$ as any).ctx.$scope = app | ||
| ;(vm.$ as any).ctx.$hasHook = hasHook | ||
| ;(vm.$ as any).ctx.$callHook = callHook |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.