@mpxjs/core 2.9.9 → 2.9.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/observer/scheduler.js +19 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/core",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.10",
|
|
4
4
|
"description": "mpx runtime core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miniprogram",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"url": "https://github.com/didi/mpx/issues"
|
|
48
48
|
},
|
|
49
49
|
"sideEffects": false,
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "d2e853a8246e8f9c37f8439c9e276bde22c3ba38"
|
|
51
51
|
}
|
|
@@ -69,10 +69,11 @@ export function queueJob (job) {
|
|
|
69
69
|
// if the job is a watch() callback, the search will start with a +1 index to
|
|
70
70
|
// allow it recursively trigger itself - it is the user's responsibility to
|
|
71
71
|
// ensure it doesn't end up in an infinite loop.
|
|
72
|
-
if ((
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
if ((
|
|
73
|
+
!queue.length ||
|
|
74
|
+
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)
|
|
75
|
+
) &&
|
|
76
|
+
job !== currentPreFlushParentJob) {
|
|
76
77
|
if (job.id == null) {
|
|
77
78
|
queue.push(job)
|
|
78
79
|
} else {
|
|
@@ -93,11 +94,17 @@ function queueFlush () {
|
|
|
93
94
|
}
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
// todo follow vue
|
|
96
98
|
export function flushPreFlushCbs (seen, parentJob = null) {
|
|
97
99
|
if (pendingPreFlushCbs.length) {
|
|
98
|
-
|
|
99
|
-
activePreFlushCbs = [...new Set(pendingPreFlushCbs)]
|
|
100
|
+
const deduped = [...new Set(pendingPreFlushCbs)]
|
|
100
101
|
pendingPreFlushCbs.length = 0
|
|
102
|
+
if (activePreFlushCbs) {
|
|
103
|
+
activePreFlushCbs.push(...deduped)
|
|
104
|
+
return
|
|
105
|
+
}
|
|
106
|
+
currentPreFlushParentJob = parentJob
|
|
107
|
+
activePreFlushCbs = deduped
|
|
101
108
|
if (isDev) seen = seen || new Map()
|
|
102
109
|
for (
|
|
103
110
|
preFlushIndex = 0;
|
|
@@ -117,10 +124,14 @@ export function flushPreFlushCbs (seen, parentJob = null) {
|
|
|
117
124
|
|
|
118
125
|
export function flushPostFlushCbs (seen) {
|
|
119
126
|
if (pendingPostFlushCbs.length) {
|
|
120
|
-
|
|
127
|
+
const deduped = [...new Set(pendingPostFlushCbs)]
|
|
121
128
|
pendingPostFlushCbs.length = 0
|
|
129
|
+
if (activePostFlushCbs) {
|
|
130
|
+
activePostFlushCbs.push(...deduped)
|
|
131
|
+
return
|
|
132
|
+
}
|
|
133
|
+
activePostFlushCbs = deduped
|
|
122
134
|
if (isDev) seen = seen || new Map()
|
|
123
|
-
|
|
124
135
|
// activePostFlushCbs.sort((a, b) => getId(a) - getId(b))
|
|
125
136
|
for (
|
|
126
137
|
postFlushIndex = 0;
|