react-component / react-component/tooltip

Tooltip triggers reflow & redraw too much times at any tooltip prop update

Open
#169 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
944
Forks
199
Avg merge
19h 1m
Merged PRs (30d)
3

Description

The problem located in Content.js file at lines:

  componentDidUpdate() {
    const { trigger } = this.props;
    if (trigger) {
      trigger.forcePopupAlign();
    }
  }

On every re-render/changing props it invokes forcePopupAlign. Using tooltip inside heavy and complex application with dozen nested component leads to freezing the page.
My suggestion is to implement more smarter calling of forcePopupAlign. For the most cases (except very dynamic ones) it is more than enough to move the logic out from componentDidUpdate to componentDidMount.

screen shot 2019-02-20 at 01 45 55

Contributor guide

No contributing guide indexed for this repository

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

Start with Content.js at the componentDidUpdate method and trace when trigger.forcePopupAlign() runs during tooltip prop updates. Compare the current behavior with the suggested lifecycle change, then verify that alignment still occurs when needed without repeated reflow and redraw during ordinary updates.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.