Skip to content

Commit

Permalink
fix: unnecessary rerenders due to props.height
Browse files Browse the repository at this point in the history
  • Loading branch information
nileshgulia1 committed Jun 4, 2024
1 parent 09db059 commit 36c012d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/PrivacyProtection/PrivacyProtection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ const PrivacyProtection = (props) => {
const url = getFilteredURL(mapUrl, connected_data_parameters);

const height = React.useMemo(() => {
if (!props.height || enabled || !show) return 'auto';
if (isNumber(props.height)) return `${props.height}px`;
if (!props.height) return 'auto';
if (isNumber(parseInt(props.height))) return `${props.height}px`;
return props.height;
}, [props.height, enabled, show]);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

React.useEffect(() => {
if (bgImg) {
Expand Down

0 comments on commit 36c012d

Please sign in to comment.