Skip to content

refactor(tooltip): reuse OverlayRef and portal #9637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2018

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Jan 27, 2018

  • Reworks the tooltip to reuse the OverlayRef after the first time it is opened, rather than destroying it and creating a new one for every subsequent open. This reduces the overhead from having the create new overlays all the time.
  • Changes the signature of the ConnectedPositionStrategy.withScrollableContainers method to return the position strategy. This is primarily for consistency with the other methods.

* Reworks the tooltip to reuse the `OverlayRef` after the first time it is opened, rather than destroying it and creating a new one for every subsequent open. This reduces the overhead from having the create the new overlays all the time.
* Changes the signature of the `ConnectedPositionStrategy.withScrollableContainers` method to return the position strategy. This is primarily for consistency with the other methods.
@crisbeto crisbeto added pr: needs review merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note labels Jan 27, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jan 27, 2018
@crisbeto
Copy link
Member Author

Caretaker note: there may be some tests that need an extra detectChanges call.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

this._scrollDispatcher.getAncestorScrollContainers(this._elementRef)
);

strategy.onPositionChange.pipe(filter(() => !!this._tooltipInstance)).subscribe(change => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!! shouldn't be necessary here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is because filter's predicate function is a (value: T, index: number) => boolean.

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release and removed pr: needs review labels Jan 30, 2018
@jelbourn
Copy link
Member

Going to mark as major since it might affect unit tests

@mmalerba mmalerba merged commit 3b48c0d into angular:master Feb 8, 2018
tinayuangao pushed a commit that referenced this pull request Feb 9, 2018
* Reworks the tooltip to reuse the `OverlayRef` after the first time it is opened, rather than destroying it and creating a new one for every subsequent open. This reduces the overhead from having the create the new overlays all the time.
* Changes the signature of the `ConnectedPositionStrategy.withScrollableContainers` method to return the position strategy. This is primarily for consistency with the other methods.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants