@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/VideoPlayer.js
CHANGED
|
@@ -159,6 +159,20 @@ function Video({
|
|
|
159
159
|
const [userReaction, setUserReaction] = useState(parsed.rating?.userReaction ?? null);
|
|
160
160
|
const userReactionRef = useRef(userReaction);
|
|
161
161
|
userReactionRef.current = userReaction;
|
|
162
|
+
const ratingInitializedRef = useRef(false);
|
|
163
|
+
const incomingCounts = parsed.rating?.counts;
|
|
164
|
+
const incomingUserReaction = parsed.rating?.userReaction;
|
|
165
|
+
useEffect(() => {
|
|
166
|
+
if (ratingInitializedRef.current) return;
|
|
167
|
+
if (!incomingCounts && incomingUserReaction === void 0) return;
|
|
168
|
+
ratingInitializedRef.current = true;
|
|
169
|
+
if (incomingCounts) {
|
|
170
|
+
setRatingCounts({ LOVE: incomingCounts.LOVE ?? 0, LIKE: incomingCounts.LIKE ?? 0, DISLIKE: incomingCounts.DISLIKE ?? 0 });
|
|
171
|
+
}
|
|
172
|
+
if (incomingUserReaction !== void 0) {
|
|
173
|
+
setUserReaction(incomingUserReaction ?? null);
|
|
174
|
+
}
|
|
175
|
+
}, [incomingCounts?.LOVE, incomingCounts?.LIKE, incomingCounts?.DISLIKE, incomingUserReaction]);
|
|
162
176
|
const onReactRef = useRef(parsed.rating?.onReact);
|
|
163
177
|
onReactRef.current = parsed.rating?.onReact;
|
|
164
178
|
const [preview, setPreview] = useState(null);
|