nusmods icon indicating copy to clipboard operation
nusmods copied to clipboard

`GlobalSearch` renders unnecessarily when not empty

Open taneliang opened this issue 5 years ago • 0 comments

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Start NUSMods locally (you can't use nusmods.com as we need a development copy of React).

  2. Type something into global search.

  3. Begin recording a profile in the React Profiler (Chrome version here).

  4. Do something unrelated to global search, e.g. go to http://localhost:8080/contribute and click the Show More button in the Map the School section.

  5. Stop the recording.

  6. Notice GlobalSearch rendered: image

  7. Reload the page, and record another profile without entering anything into global search. Notice that GlobalSearch did not render and that there were fewer renders: image

Expected behavior

GlobalSearch should not render unnecessarily.

Additional context

It may be easier to fix this after #3039 is merged, so that we can use the React scheduling profiler to see if there are any unexpected state updates.

taneliang avatar Dec 18 '20 07:12 taneliang