nusmodifications / nusmodifications/nusmods
`GlobalSearch` renders unnecessarily when not empty
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 689
- Forks
- 364
- Avg merge
- 7h 5m
- Merged PRs (30d)
- 14
Description
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
-
Start NUSMods locally (you can't use nusmods.com as we need a development copy of React).
-
Type something into global search.
-
Begin recording a profile in the React Profiler (Chrome version here).
-
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.
-
Stop the recording.
-
Notice
GlobalSearch rendered:

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

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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start NUSMods locally, enter text in global search, and use the React Profiler while performing an unrelated action such as expanding Map the School; done when GlobalSearch no longer renders unnecessarily during that interaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100