Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: unnecessary re-render due to useMemo #62

Merged
merged 9 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,19 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [10.0.0](https://github.com/eea/volto-embed/compare/9.1.1...10.0.0) - 23 April 2024
### [10.0.1](https://github.com/eea/volto-embed/compare/10.0.0...10.0.1) - 4 June 2024

#### :bug: Bug Fixes

- fix: do not use props.height on every render [nileshgulia1 - [`9ea9155`](https://github.com/eea/volto-embed/commit/9ea91552f90da332a9358c7f57a83359493b42f4)]
- fix: use parseInt [nileshgulia1 - [`8bdfb95`](https://github.com/eea/volto-embed/commit/8bdfb95708b263b48f801b241a0941f889023e46)]
- fix: Number parsing [nileshgulia1 - [`388705b`](https://github.com/eea/volto-embed/commit/388705b04a5140e305224fbd9229cacbdf3b2f84)]
- fix: unnecessary re-render due to useMemo [nileshgulia1 - [`c485d05`](https://github.com/eea/volto-embed/commit/c485d055c8a94337d26c66dfd03b127a196f6ca3)]

#### :hammer_and_wrench: Others

- test: add cypress 13 to devdependencies [ana-oprea - [`b341aaf`](https://github.com/eea/volto-embed/commit/b341aaf1d0a1c0e2b15c77b725481ca50943c190)]
## [10.0.0](https://github.com/eea/volto-embed/compare/9.1.1...10.0.0) - 23 April 2024

#### :rocket: New Features

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-embed",
"version": "10.0.0",
"version": "10.0.1",
"description": "Embed external content",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand All @@ -23,6 +23,7 @@
"@eeacms/volto-datablocks": "*"
},
"devDependencies": {
"cypress": "13.1.0",
"@cypress/code-coverage": "^3.10.0",
"@plone/scripts": "*",
"babel-plugin-transform-class-properties": "^6.24.1",
Expand Down
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