From c1a5a3dfbf1390cfa2c02e717a90aa7842093cd8 Mon Sep 17 00:00:00 2001 From: Gido Manders Date: Wed, 11 Dec 2024 17:05:28 +0100 Subject: [PATCH] fix: FavoriteIcon not stopping propagation When clicking the FavoriteIcon inside an element with onClick, the onClick of the other element is triggered after the onChange of the FavoriteIcon. Added stopPropagation to prevent event propagation. --- src/core/FavoriteIcon/FavoriteIcon.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/FavoriteIcon/FavoriteIcon.tsx b/src/core/FavoriteIcon/FavoriteIcon.tsx index 9db0d7d87..fc858ac3e 100644 --- a/src/core/FavoriteIcon/FavoriteIcon.tsx +++ b/src/core/FavoriteIcon/FavoriteIcon.tsx @@ -66,6 +66,7 @@ export function FavoriteIcon({ }: FavoriteIconProps) { function onClick(e: React.MouseEvent) { e.preventDefault(); + e.stopPropagation(); onChange(!value); }