nusmodifications / nusmodifications/nusmods

`GlobalSearch` renders unnecessarily when not empty

Open
#3,060 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug good first issue performance
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:

  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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.