@mpxjs/core 2.10.6-beta.3 → 2.10.6-beta.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.10.6-beta.3",
3
+ "version": "2.10.6-beta.5",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -422,7 +422,7 @@ function usePageStatus (navigation, pageId) {
422
422
  function usePagePreload (route) {
423
423
  const name = route.name
424
424
  useEffect(() => {
425
- setTimeout(() => {
425
+ const timer = setTimeout(() => {
426
426
  const preloadRule = global.__preloadRule || {}
427
427
  const { packages } = preloadRule[name] || {}
428
428
  if (packages?.length > 0) {
@@ -432,6 +432,10 @@ function usePagePreload (route) {
432
432
  }
433
433
  }
434
434
  }, 800)
435
+
436
+ return () => {
437
+ clearTimeout(timer)
438
+ }
435
439
  }, [])
436
440
  }
437
441