@geekapps/silo-elements-nextjs 0.2.60 → 0.2.61
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/dist/VideoPlayer.js +14 -0
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1286,6 +1286,20 @@ function Video({
|
|
|
1286
1286
|
const [userReaction, setUserReaction] = useState(parsed.rating?.userReaction ?? null);
|
|
1287
1287
|
const userReactionRef = useRef(userReaction);
|
|
1288
1288
|
userReactionRef.current = userReaction;
|
|
1289
|
+
const ratingInitializedRef = useRef(false);
|
|
1290
|
+
const incomingCounts = parsed.rating?.counts;
|
|
1291
|
+
const incomingUserReaction = parsed.rating?.userReaction;
|
|
1292
|
+
useEffect(() => {
|
|
1293
|
+
if (ratingInitializedRef.current) return;
|
|
1294
|
+
if (!incomingCounts && incomingUserReaction === void 0) return;
|
|
1295
|
+
ratingInitializedRef.current = true;
|
|
1296
|
+
if (incomingCounts) {
|
|
1297
|
+
setRatingCounts({ LOVE: incomingCounts.LOVE ?? 0, LIKE: incomingCounts.LIKE ?? 0, DISLIKE: incomingCounts.DISLIKE ?? 0 });
|
|
1298
|
+
}
|
|
1299
|
+
if (incomingUserReaction !== void 0) {
|
|
1300
|
+
setUserReaction(incomingUserReaction ?? null);
|
|
1301
|
+
}
|
|
1302
|
+
}, [incomingCounts?.LOVE, incomingCounts?.LIKE, incomingCounts?.DISLIKE, incomingUserReaction]);
|
|
1289
1303
|
const onReactRef = useRef(parsed.rating?.onReact);
|
|
1290
1304
|
onReactRef.current = parsed.rating?.onReact;
|
|
1291
1305
|
const [preview, setPreview] = useState(null);
|