Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-108379

Avoid repeated "find" scans when rendering MainSearch component

    Details

      Description

      In general, looping over a list to find something on every render is best avoided. In this case, I suspect the list of filters is very short, so it doesn't actually matter: but having said that, to avoid the pattern here getting copied elsewhere where it actually does matter, we should probably use useMemo to make sure that we don't recompute the mainFilter repeatedly. Question is, is it worth trading a small bit of storage (ie. for the memoization) in order to avoid a pattern that we don't want copied? It is almost certainly not any faster than just recomputing. I am not sure about this one, so going to leave it open until tomorrow and make a decision then.

        Attachments

          Activity

            People

            Assignee:
            fabio.mastrorilli Fabio Mastrorilli
            Reporter:
            greg.hurrell Greg Hurrell (Inactive)
            Engineering Assignee:
            Greg Hurrell (Inactive)
            Recent user:
            Greg Hurrell (Inactive)
            Participants of an Issue:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:

                Packages

                Version Package