@micromag/core 0.4.38 → 0.4.41
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/components.js +105 -91
- package/es/contexts.js +23 -1
- package/lib/components.js +105 -91
- package/lib/contexts.js +23 -1
- package/package.json +18 -18
package/es/contexts.js
CHANGED
|
@@ -1023,23 +1023,45 @@ var usePlaybackMediaRef = function usePlaybackMediaRef() {
|
|
|
1023
1023
|
// Cleanup: clear media registration when this screen deactivates or unmounts.
|
|
1024
1024
|
// Note: we cannot check mediaRef.current here because React clears callback refs
|
|
1025
1025
|
// before running effect cleanups, so mediaRef.current is always null at this point.
|
|
1026
|
+
|
|
1026
1027
|
useEffect(function () {
|
|
1027
1028
|
return function () {
|
|
1028
1029
|
if (active) {
|
|
1030
|
+
console.log('clear media');
|
|
1029
1031
|
setMedia(null);
|
|
1030
1032
|
setIsBackground(false);
|
|
1031
1033
|
}
|
|
1032
1034
|
};
|
|
1033
|
-
}, [active, setMedia, setIsBackground]);
|
|
1035
|
+
}, [active, setMedia, setIsBackground, updateKey]);
|
|
1036
|
+
|
|
1037
|
+
// useEffect(() => {
|
|
1038
|
+
// if (!active) {
|
|
1039
|
+
// console.log('unset media');
|
|
1040
|
+
// setMedia(null);
|
|
1041
|
+
// setIsBackground(false);
|
|
1042
|
+
// }
|
|
1043
|
+
// return () => {
|
|
1044
|
+
// if (active) {
|
|
1045
|
+
// console.log('clear media');
|
|
1046
|
+
// setMedia(null);
|
|
1047
|
+
// setIsBackground(false);
|
|
1048
|
+
// }
|
|
1049
|
+
// };
|
|
1050
|
+
// }, [active, setMedia, setIsBackground]);
|
|
1034
1051
|
|
|
1035
1052
|
// Register media with context when active and no media is registered
|
|
1036
1053
|
useEffect(function () {
|
|
1054
|
+
console.log('try to register media');
|
|
1037
1055
|
if (!active || mediaRef.current === null || media !== null) {
|
|
1038
1056
|
return;
|
|
1039
1057
|
}
|
|
1058
|
+
console.log('register media');
|
|
1040
1059
|
setIsBackground(background);
|
|
1041
1060
|
setMedia(mediaRef.current);
|
|
1042
1061
|
}, [active, background, media, updateKey, setMedia, setIsBackground]);
|
|
1062
|
+
|
|
1063
|
+
// console.log('playback', mediaRef.current, media);
|
|
1064
|
+
|
|
1043
1065
|
return {
|
|
1044
1066
|
ref: mediaRef,
|
|
1045
1067
|
isCurrent: mediaRef.current === media
|