Project:
| View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||||||
| ID | ||||||||||||
| 0051504 | ||||||||||||
| Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||||||
| defect | [POS2] POS | minor | have not tried | 2023-01-30 12:38 | 2025-03-17 13:19 | |||||||
| Reporter | jorge-garcia | View Status | public | |||||||||
| Assigned To | Triage Platform Base | |||||||||||
| Priority | normal | Resolution | open | Fixed in Version | ||||||||
| Status | scheduled | Fix in branch | Fixed in SCM revision | |||||||||
| Projection | none | ETA | none | Target Version | ||||||||
| OS | Any | Database | Any | Java version | ||||||||
| OS Version | Database version | Ant version | ||||||||||
| Product Version | SCM revision | |||||||||||
| Merge Request Status | ||||||||||||
| Review Assigned To | ||||||||||||
| OBNetwork customer | No | |||||||||||
| Support ticket | ||||||||||||
| Regression level | ||||||||||||
| Regression date | ||||||||||||
| Regression introduced in release | ||||||||||||
| Regression introduced by commit | ||||||||||||
| Triggers an Emergency Pack | No | |||||||||||
| Summary | 0051504: Replace async useEffect references from the code with proper code | |||||||||||
| Description | useEffect hook callback in React expects to return a function or nothing. Using reserved keyword async in useEffect hook callback returns instead a Promise. Using async in useEffect callback raises a warning in web console and could cause future problems during the execution of the hook. | |||||||||||
| Steps To Reproduce | These are the occurrences I found so far in the code: - ColorCellPopover.jsx - KeymapEditorCategoryDialog.jsx - ProductSelector.jsx | |||||||||||
| Proposed Solution | Imagine this is the code we have right now: const [state, setState] = useState(0); useEffect(async () => { const data = await getData() setState(data) }, []); The idea is to change the code from this: const [state, setState] = useState(0); useEffect(() => { const fetchData = async()=> { const data = await getData() setState(data); }; fetchData(); }, []); There is another alternative that is to implement the asynchronous function into a useCallback hook: const [state, setState] = useState(0); const fetchData = useCallback(async()=> { const data = await getData(); setState(data); }, []); useEffect(() => { fetchData() }, [fetchData]); | |||||||||||
| Tags | No tags attached. | |||||||||||
| Attached Files | ||||||||||||
Relationships [ Relation Graph ]
[ Dependency Graph ]
|
|
Notes |
|
|
(0175143) hgbot (developer) 2025-02-05 08:49 |
Issue exported to Jira: https://openbravo-sandbox-609.atlassian.net/browse/RM-20194 [^] |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2023-01-30 12:38 | jorge-garcia | New Issue | |
| 2023-01-30 12:38 | jorge-garcia | Assigned To | => Retail |
| 2023-01-30 12:38 | jorge-garcia | OBNetwork customer | => No |
| 2023-01-30 12:38 | jorge-garcia | Triggers an Emergency Pack | => No |
| 2023-07-31 09:11 | sreehari | Assigned To | Retail => Rajesh_18 |
| 2023-08-01 06:23 | Rajesh_18 | Status | new => scheduled |
| 2025-02-02 06:04 | guillermogil | Severity | major => minor |
| 2025-02-05 08:49 | hgbot | Note Added: 0175143 | |
| 2025-03-17 13:19 | migueldejuana | Assigned To | Rajesh_18 => Triage Platform Base |
| Copyright © 2000 - 2009 MantisBT Group |