Skip to content

Bug - [Truncate] - remove resize observer #10974

Open
@christianvogt

Description

@christianvogt

Describe the problem

I don’t believe there’s need for the Truncate component to be calculating whether or not to include the tooltip upfront or even on resize. The tooltip is only shown either on mouse over or on focus. Therefore it should be possible to remove the resize observer.

Furthermore, this component unmounts the children whenever the truncation state changes instead of simply marking the tooltip as hidden.

It would seem to me that a lot of performance could be gained here if a page contains many Truncate components susceptible to resizing.

How do you reproduce the problem?
Visit https://www.patternfly.org/components/truncate#default
Using inspector dev tools, to track react component re-renders.
Drag the bounding box of the truncated text such that all the text is shown and then back to truncated.

Observe the component remounts every time the threshold is met.

Expected behavior
Unless the content changes, the component shouldn't remount.

Is this issue blocking you?
No

What is your environment?

  • OS: mac
  • Browser chrome
  • Version 127

What is your product and what release date are you targeting?
RHOAI

Any other information?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions