create-packer 1.17.9 → 1.17.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.17.9",
3
+ "version": "1.17.10",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -10,12 +10,18 @@ export default function useComponentInstance<
10
10
  props?: P
11
11
  ) {
12
12
  const $instance = useRef<(Refs & componentInstance.refsType<P>) | null>(null)
13
+ const pending = useRef(false)
13
14
 
14
15
  useEffect(() => {
15
- componentInstance.create(key, Component, props).then(instance => {
16
- $instance.current = instance
17
- })
18
- }, [])
16
+ if (pending.current === false) {
17
+ pending.current = true
18
+ componentInstance.create(key, Component, props).then(instance => {
19
+ $instance.current = instance
20
+ })
21
+ } else {
22
+ $instance.current?.$updateProps(props)
23
+ }
24
+ }, [props])
19
25
 
20
26
  return $instance
21
27
  }