Openbravo Issue Tracking System - POS2 | |||||
| View Issue Details | |||||
| ID | Project | Category | View Status | Date Submitted | Last Update |
| 0051504 | POS2 | POS | public | 2023-01-30 12:38 | 2025-03-17 13:19 |
| Reporter | jorge-garcia | ||||
| Assigned To | Triage Platform Base | ||||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | scheduled | Resolution | open | ||
| Platform | OS | 5 | OS Version | ||
| Product Version | |||||
| Target Version | Fixed in Version | ||||
| 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]); | ||||
| Additional Information | |||||
| Tags | No tags attached. | ||||
| Relationships | |||||
| Attached Files | |||||
| 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 | ||
| Notes | |||||
|
|
|||||
|
|
||||