Skip to content

Commit

Permalink
fix: use effect to set prop change value
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Jul 6, 2023
1 parent 879eee1 commit 265bcfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/ClickableTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const ClickableTooltip: React.FC<ClickableTooltipProps> = ({
}) => {
const [_open, _setOpen] = React.useState(open);

React.useEffect(() => { _setOpen(open); }, [open]);

return (
<Tooltip
open={_open}
Expand Down
2 changes: 2 additions & 0 deletions src/components/page/Notification.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const Notification: React.FC<NotificationProps> = ({
}) => {
const [_open, _setOpen] = React.useState(open);

React.useEffect(() => { _setOpen(open); }, [open]);

if (!_open) return <></>;

// @ts-expect-error guaranteed to be in palette
Expand Down

0 comments on commit 265bcfe

Please sign in to comment.