Skip to content

ResizeSensor kills performance when meets with a Window type #303

Open
@kergekacsa

Description

@kergekacsa

Hi there!

I've found an infinit loop in this line: (at https://github.com/marcj/css-element-queries/blob/master/src/ResizeSensor.js#L239 )
var invisible = element.offsetWidth === 0 && element.offsetHeight === 0;

The problem is that Windows types doesn't have offsetWidth/offsetHeight, so it's basically redraw the whole layout again and again.
It would be a nice touch if in case os a Window type if could use a little smarter check for invisibility. I've think something like this:
https://gist.github.com/danbrianwhite/bcdd7fbd6d775a4e0dc0

What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions