teamplay 0.1.12 → 0.1.13

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": "teamplay",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Full-stack signals ORM with multiplayer",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -23,12 +23,12 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@nx-js/observer-util": "^4.1.3",
26
- "@teamplay/backend": "^0.1.12",
27
- "@teamplay/cache": "^0.1.12",
28
- "@teamplay/channel": "^0.1.12",
29
- "@teamplay/debug": "^0.1.12",
30
- "@teamplay/schema": "^0.1.12",
31
- "@teamplay/utils": "^0.1.12",
26
+ "@teamplay/backend": "^0.1.13",
27
+ "@teamplay/cache": "^0.1.13",
28
+ "@teamplay/channel": "^0.1.13",
29
+ "@teamplay/debug": "^0.1.13",
30
+ "@teamplay/schema": "^0.1.13",
31
+ "@teamplay/utils": "^0.1.13",
32
32
  "diff-match-patch": "^1.0.5",
33
33
  "events": "^3.3.0",
34
34
  "json0-ot-diff": "^1.1.2",
@@ -63,5 +63,5 @@
63
63
  ]
64
64
  },
65
65
  "license": "MIT",
66
- "gitHead": "63672ca0f00e682d687585088094a59746a42015"
66
+ "gitHead": "1abacbe2dd704f77dfa20d061edf89490ac65cee"
67
67
  }
package/react/helpers.js CHANGED
@@ -28,8 +28,8 @@ export function useId () {
28
28
  }
29
29
 
30
30
  export function useUnmount (fn) {
31
- const fnRef = useRef(fn)
32
- fnRef.current = fn
31
+ const fnRef = useRef()
32
+ if (fnRef.current !== fn) fnRef.current = fn
33
33
  useEffect(
34
34
  () => () => {
35
35
  fnRef.current()
@@ -9,7 +9,8 @@ export default function universal$ ($root, value) {
9
9
  const id = executionContextTracker.newHookId()
10
10
  const $signal = $($root, value, id)
11
11
  // save signal into ref to make sure it's not garbage collected while component exists
12
- useRef($signal) // eslint-disable-line react-hooks/rules-of-hooks
12
+ const $signalRef = useRef() // eslint-disable-line react-hooks/rules-of-hooks
13
+ if ($signalRef.current !== $signal) $signalRef.current = $signal
13
14
  return $signal
14
15
  } else {
15
16
  return $($root, value)
@@ -10,7 +10,8 @@ export default function universalSub (...args) {
10
10
  // 1. if it's a promise, throw it so that Suspense can catch it and wait for subscription to finish
11
11
  if (promiseOrSignal.then) throw promiseOrSignal
12
12
  // 2. if it's a signal, we save it into ref to make sure it's not garbage collected while component exists
13
- useRef(promiseOrSignal) // eslint-disable-line react-hooks/rules-of-hooks
13
+ const $signalRef = useRef() // eslint-disable-line react-hooks/rules-of-hooks
14
+ if ($signalRef.current !== promiseOrSignal) $signalRef.current = promiseOrSignal
14
15
  }
15
16
  return promiseOrSignal
16
17
  }