@micromag/core 0.4.30 → 0.4.33
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/es/contexts.js +4 -7
- package/lib/contexts.js +4 -7
- package/package.json +2 -2
package/es/contexts.js
CHANGED
|
@@ -1019,16 +1019,13 @@ var usePlaybackMediaRef = function usePlaybackMediaRef() {
|
|
|
1019
1019
|
setIsBackground = _usePlaybackContext.setIsBackground,
|
|
1020
1020
|
media = _usePlaybackContext.media;
|
|
1021
1021
|
var mediaRef = useRef(null);
|
|
1022
|
-
// Track latest media value in a ref so the cleanup function can check ownership
|
|
1023
|
-
// without having media in the dependency array (which would cause cleanup to run
|
|
1024
|
-
// on every registration, immediately clearing the media that was just set).
|
|
1025
|
-
var mediaValueRef = useRef(media);
|
|
1026
|
-
mediaValueRef.current = media;
|
|
1027
1022
|
|
|
1028
|
-
// Cleanup:
|
|
1023
|
+
// Cleanup: clear media registration when this screen deactivates or unmounts.
|
|
1024
|
+
// Note: we cannot check mediaRef.current here because React clears callback refs
|
|
1025
|
+
// before running effect cleanups, so mediaRef.current is always null at this point.
|
|
1029
1026
|
useEffect(function () {
|
|
1030
1027
|
return function () {
|
|
1031
|
-
if (active
|
|
1028
|
+
if (active) {
|
|
1032
1029
|
setMedia(null);
|
|
1033
1030
|
setIsBackground(false);
|
|
1034
1031
|
}
|
package/lib/contexts.js
CHANGED
|
@@ -1019,16 +1019,13 @@ var usePlaybackMediaRef = function usePlaybackMediaRef() {
|
|
|
1019
1019
|
setIsBackground = _usePlaybackContext.setIsBackground,
|
|
1020
1020
|
media = _usePlaybackContext.media;
|
|
1021
1021
|
var mediaRef = React.useRef(null);
|
|
1022
|
-
// Track latest media value in a ref so the cleanup function can check ownership
|
|
1023
|
-
// without having media in the dependency array (which would cause cleanup to run
|
|
1024
|
-
// on every registration, immediately clearing the media that was just set).
|
|
1025
|
-
var mediaValueRef = React.useRef(media);
|
|
1026
|
-
mediaValueRef.current = media;
|
|
1027
1022
|
|
|
1028
|
-
// Cleanup:
|
|
1023
|
+
// Cleanup: clear media registration when this screen deactivates or unmounts.
|
|
1024
|
+
// Note: we cannot check mediaRef.current here because React clears callback refs
|
|
1025
|
+
// before running effect cleanups, so mediaRef.current is always null at this point.
|
|
1029
1026
|
React.useEffect(function () {
|
|
1030
1027
|
return function () {
|
|
1031
|
-
if (active
|
|
1028
|
+
if (active) {
|
|
1032
1029
|
setMedia(null);
|
|
1033
1030
|
setIsBackground(false);
|
|
1034
1031
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@micromag/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"keywords": [
|
|
@@ -161,6 +161,6 @@
|
|
|
161
161
|
"access": "public",
|
|
162
162
|
"registry": "https://registry.npmjs.org/"
|
|
163
163
|
},
|
|
164
|
-
"gitHead": "
|
|
164
|
+
"gitHead": "8c44ced53cad6b575c85b556eb246f477cfb4933",
|
|
165
165
|
"types": "es/index.d.ts"
|
|
166
166
|
}
|