Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Completed
    • Affects Version/s: None
    • Fix Version/s: Master
    • Labels:
      None

      Description

      We need to be careful about running side effects on unmounted components, so comments like this one come up in code review a lot:

      https://github.com/wincent/liferay-portal/pull/73#discussion_r334983094

      > Please add an isMounted() check inside the callback here (ie. use the useIsMounted hook from frontend-js-react-web). 

      In this LPS we should do the first of two or three things:

      1. Make a "useDelay" hook to be used in place of "setTimeout" and have it automatically handle the "isMounted" check.
      2. Later on, add a lint to guard against unsafe "setTimeout" in React components (may be non-trivial, which is why I suggest doing it as a separate step).
      3. Go back to pulls like the one I linked above and replace existing "setTimeout" usages with "useDelay" instead.

       

        Attachments

          Activity

            People

            • Assignee:
              brian.chan Brian Chan
              Reporter:
              greg.hurrell Greg Hurrell
              Recent user:
              Enterprise Release HU
              Participants of an Issue:
              Engineering Assignee:
              Greg Hurrell
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Packages

                Version Package
                Master