sir-dunxalot / ember-tooltips

Easy and extendible tooltips for Ember components - http://sir-dunxalot.github.io/ember-tooltips/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Performance issue in 3.X

panthony opened this issue · comments

On a given screen in my app I may have hundreds of possible popovers.

Some of them may be costly to render.

in 2.x I was using enableLazyRendering which was perfect since it did not render the content of the popover until it was actually displayed.

This option was removed in 3.x without, as far as I can tell, any replacement.

Unfortunately this make this addon unusable for me in its 3.x version.

Turns out passing popperContainer="body" will make ember-tooltip behave like it was with enableLazyRendering: true.

Thus using this option will fix this issue in my case.

I'll leave it open unless you feel like this is an edge case.

The use of popper.js in 3.x addresses performance in a couple different ways that mostly make the old lazy rendering option unnecessary.

  1. It uses requestAnimationFrame to handle updates to the DOM, which provides smooth 60FPS updates.
  2. It does not update or re-position tooltips that are not shown.
  3. Tooltips are only rendered on activation & are torn down when hidden.

The content will still be rendered in the DOM, but is hidden and not rendered into a tooltip/popover until it's activated.

If the content inside the tooltip is what's costly to render, there is an escape hatch, e.g.:

{{#ember-popover as |popover|}}
  {{#if popover.isShown}}
      {{expensive-component-thing}}
  {{/if}}
{{/ember-popover}}

Ok ! Good to know for popover.isShown.

And since the popperContainer="body" already workaround this issue for me (by only appending the tooltip when shown) i'll close this issue too.

Thanks for your time @maxfierke