Closed
Description
This issue is automatically created based on existing pull request: #30695: Avoid binding magnifier events in duplicate on resize
Description
A browser resize event will trigger the magnifier to be re-initialised. This includes binding a fresh set of event listeners to the image so that the magnifier will show as expected (on click or hover). However, there is no mechanism to unbind the old event listeners, so each time the browser triggers a resize event these will stack.
This is made worse by the 'hover' event type triggering the 'mouseover' event immediately after adding a listener for the same. This means that each resize event will consume progressively more CPU, without any additional value.
Related Pull Requests
None
Fixed Issues
None
Manual testing scenarios
- Visit a product page with magnifier in use and configured for hover events
- Observe the resting CPU usage of the page
- Resize the viewport (either height or width)
- Observe a spike in CPU usage, which subsides
- Resize the viewport several times
- Observe a progressively longer spike in CPU usage
- Continue resizing the viewport and notice that CPU eventually (after ~8 resizes in my experience) caps out at 100% for an unacceptable amount of time (several minutes), rendering the page useless.
Questions or comments
None
Contribution checklist
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- All automated tests passed successfully (all builds are green)
Metadata
Metadata
Assignees
Labels
The issue has been fixed in 2.4-develop branchGate 2 Passed. Manual verification of the issue description passedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedA defect with this priority could have functionality issues which are not to expectations.May be fixed according to the position in the backlog.The issue has been reproduced on latest 2.4-develop branchAffects non-critical data or functionality and does not force users to employ a workaround.
Type
Projects
Status
Done