Revert "fix(native/community): sync realtime-patched likes_count back into PostCard"
This reverts commit 4c4792c153aa6949fc656ed570c0c147ba33ec87.
This commit is contained in:
parent
1bc38e0732
commit
ab9472b976
@ -30,14 +30,6 @@ function PostCardImpl({ post, onCommentPress }: Props) {
|
|||||||
const [localCount, setLocalCount] = useState(post.likesCount);
|
const [localCount, setLocalCount] = useState(post.likesCount);
|
||||||
const [isLiking, setIsLiking] = useState(false);
|
const [isLiking, setIsLiking] = useState(false);
|
||||||
|
|
||||||
// Sync realtime-patched prop values into local state. Guarded by isLiking so
|
|
||||||
// an in-flight optimistic update is never clobbered by a concurrent patch.
|
|
||||||
useEffect(() => {
|
|
||||||
if (isLiking) return;
|
|
||||||
setLocalCount(post.likesCount);
|
|
||||||
setLocalLike(post.userLike === 'like' ? 'like' : null);
|
|
||||||
}, [post.likesCount, post.userLike, isLiking]);
|
|
||||||
|
|
||||||
// Heart-Pop Animation — Insta-Style: quick scale-up + spring-bounce back
|
// Heart-Pop Animation — Insta-Style: quick scale-up + spring-bounce back
|
||||||
const heartScale = useRef(new Animated.Value(1)).current;
|
const heartScale = useRef(new Animated.Value(1)).current;
|
||||||
const triggerHeartPop = useCallback(() => {
|
const triggerHeartPop = useCallback(() => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user