@geekapps/silo-elements-nextjs 0.2.59 → 0.2.60
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 +4 -1
- package/dist/VideoPlayer.js.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1284,6 +1284,8 @@ function Video({
|
|
|
1284
1284
|
() => ({ LOVE: parsed.rating?.counts?.LOVE ?? 0, LIKE: parsed.rating?.counts?.LIKE ?? 0, DISLIKE: parsed.rating?.counts?.DISLIKE ?? 0 })
|
|
1285
1285
|
);
|
|
1286
1286
|
const [userReaction, setUserReaction] = useState(parsed.rating?.userReaction ?? null);
|
|
1287
|
+
const userReactionRef = useRef(userReaction);
|
|
1288
|
+
userReactionRef.current = userReaction;
|
|
1287
1289
|
const onReactRef = useRef(parsed.rating?.onReact);
|
|
1288
1290
|
onReactRef.current = parsed.rating?.onReact;
|
|
1289
1291
|
const [preview, setPreview] = useState(null);
|
|
@@ -2807,9 +2809,10 @@ function Video({
|
|
|
2807
2809
|
setUserReaction(next);
|
|
2808
2810
|
setRatingCounts((prev) => {
|
|
2809
2811
|
const updated = { ...prev };
|
|
2812
|
+
const prev_reaction = userReactionRef.current;
|
|
2810
2813
|
if (active) updated[key] = Math.max(0, (updated[key] ?? 0) - 1);
|
|
2811
2814
|
else {
|
|
2812
|
-
if (
|
|
2815
|
+
if (prev_reaction) updated[prev_reaction] = Math.max(0, (updated[prev_reaction] ?? 0) - 1);
|
|
2813
2816
|
updated[key] = (updated[key] ?? 0) + 1;
|
|
2814
2817
|
}
|
|
2815
2818
|
return updated;
|