Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[POS2] POSmajorhave not tried2023-01-30 12:382023-08-01 06:23
Reporterjorge-garciaView Statuspublic 
Assigned ToRajesh_18 
PrioritynormalResolutionopenFixed in Version
StatusscheduledFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo

0051504: Replace async useEffect references from the code with proper code

DescriptionuseEffect 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 ReproduceThese are the occurrences I found so far in the code:

- ColorCellPopover.jsx
- KeymapEditorCategoryDialog.jsx
- ProductSelector.jsx
Proposed SolutionImagine this is the code we have right now:
  const [state, setState] = useState(0);

  useEffect(async () => {
    const data = await getData()
  }, []);

The idea is to change the code from this:
  const [state, setState] = useState(0);

  useEffect(() => {
    const fetchData = async()=> {
      const data = await getData()

   }, []);

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();

  }, []);

  useEffect(() => {
  }, [fetchData]);
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
There are no notes attached to this issue.

- 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 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

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker