Openbravo Issue Tracking System - POS2
View Issue Details
0050542POS2POSpublic2022-10-17 09:562022-10-24 17:33
AugustoMauch 
jarmendariz 
normalcriticalhave not tried
closedfixed 
5
 
23Q1 
No
0050542: Memory leak in the Keymap Editor
There is a memory leak in the keymap editor, specifically in the window that allows to define the layout of a given keymap.

Each time a different vale is chosen from the screen resolution combo, the keymap is recomputed but the previos one does not seem to be removed from memory
- Create a big keymap with lots of products
- Open the chrome Task Manager (shift+esc) to monitor the memory usage
- Open the Keymap Editor, select the big keymap and go to the step that allows to update the layout.
- Modify the selected screen resolution several times and notice how the memory usage keeps increasing
No tags attached.
depends on backport 005054322Q4.1 closed jarmendariz Memory leak in the Keymap Editor 
depends on backport 005054422Q3.2 closed jarmendariz Memory leak in the Keymap Editor 
Issue History
2022-10-17 09:56AugustoMauchNew Issue
2022-10-17 09:56AugustoMauchAssigned To => jarmendariz
2022-10-17 09:56AugustoMauchTriggers an Emergency Pack => No
2022-10-17 09:56AugustoMauchStatusnew => scheduled
2022-10-20 12:20hgbotNote Added: 0142339
2022-10-24 17:33hgbotResolutionopen => fixed
2022-10-24 17:33hgbotStatusscheduled => closed
2022-10-24 17:33hgbotNote Added: 0142493
2022-10-24 17:33hgbotFixed in Version => 23Q1
2022-10-24 17:33hgbotNote Added: 0142494

Notes
(0142339)
hgbot   
2022-10-20 12:20   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/1298 [^]
(0142493)
hgbot   
2022-10-24 17:33   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/merge_requests/1298 [^]
(0142494)
hgbot   
2022-10-24 17:33   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2 [^]
Changeset: 0b574746f93649ec474b6ec986ced795f8f3bf68
Author: Javier Armendáriz <javier.armendariz@openbravo.com>
Date: 24-10-2022 17:15:31
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.pos2/-/commit/0b574746f93649ec474b6ec986ced795f8f3bf68 [^]

Fixed ISSUE-50542: Memory leaks in the Keymap Editor

This changeset fixes two types of memory leaks:
1- When cloning the editableLayoutRefs object in KeyMapCategoriesGrid, we copied the whole ref instead of the current
property, creating a nested structure like { current: { current: { current: ... }}}

2- If we add an event listener on an useEffect hook of a component, we should create a cleanup function that removes that
listener when the component unloads

---
M web-jspack/org.openbravo.pos2/src/components/KeyMapEditor/steps/KeyMapEditorLayout/KeyMapCategoriesGrid/KeyMapCategoriesGrid.jsx
M web-jspack/org.openbravo.pos2/src/components/KeyMapEditor/steps/KeyMapEditorLayout/KeyMapProductsGrid/KeyMapProductsGrid.jsx
M web-jspack/org.openbravo.pos2/src/components/ProductCategoryButton/ProductCategoryButton.jsx
M web-jspack/org.openbravo.pos2/src/components/ProductSearch/AvailableProductFilterButtonContent/AvailableProductFilterButtonContent.jsx
---