Skip to content

Commit

Permalink
Merge pull request #1566 from CommanderXL/fix-dynamic-ssr
Browse files Browse the repository at this point in the history
[fix]dynamic-ssr
  • Loading branch information
hiyuki authored Aug 6, 2024
2 parents 32d7319 + d71ae47 commit 999b833
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/core/src/core/proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ export default class MpxProxy {
}

created () {
// 缓存上下文,在 destoryed 阶段删除
contextMap.set(this.uid, this.target)
if (__mpx_dynamic_runtime__) {
// 缓存上下文,在 destoryed 阶段删除
contextMap.set(this.uid, this.target)
}
if (__mpx_mode__ !== 'web') {
// web中BEFORECREATE钩子通过vue的beforeCreate钩子单独驱动
this.callHook(BEFORECREATE)
Expand Down Expand Up @@ -196,8 +198,10 @@ export default class MpxProxy {
}

unmounted () {
// 页面/组件销毁清除上下文的缓存
contextMap.remove(this.uid)
if (__mpx_dynamic_runtime__) {
// 页面/组件销毁清除上下文的缓存
contextMap.remove(this.uid)
}
this.callHook(BEFOREUNMOUNT)
this.scope?.stop()
if (this.update) this.update.active = false
Expand Down

0 comments on commit 999b833

Please sign in to comment.