Skip to content

'ember-animated-hide' remains on element, applied from SpritePosition cache #241

@arthur5005

Description

@arthur5005

Describe the bug
The classList copied onto a SpritePosition instance via _getCurrentPosition can get into situations that copy the ember-animated-hide class into the cached classList

classList: Array.from(this.element.classList),

When _reapplyPosition gets called, this can result in ember-animated-hide getting re-applied, hiding sprites that may have been revealed between the _getCurrentPosition and the _reapplyPosition call.

This results in situations where ember-animated-hide remains on the sprite after all is said and done.

To Reproduce
I had a really tough time reproducing this outside of my dev codebase. I tried on twiddle to no avail, I'm worried I was also hampered by the 0.5.4 version of ember-animated in the twiddle.json, I tried to bring it up to 0.10.1 but things didn't seem build.

My situation was an {{#animated-if foo}} ... {{else animated-if bar}} ... {{else}} ... {{/animated-if}}

Where if foo == false and bar == true, the contents of the second block would have its elements hidden on initial render.

It's not clear exactly why reapplyPosition would get called after a reveal was called or perhaps why getCurrentPosition would happen on elements that were already hidden, but this scenario where ember-animated-hidden remained on the element has happened a number of times to me, and I spent some time digging this time.

Expected behaviour
The this._revealed property of a Sprite and the application of the element class ember-animated-hide should always be applied in concert and never drift.

Desktop (please complete the following information):

  • OS: Mac OS 10.15.5
  • Browser Chrome
  • Version 86

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions