question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug(animations): Element rendered twice when animated

See original GitHub issue

I’m submitting a…


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

Expected behavior

Minimal reproduction of the problem with instructions

When triggering an animation of an element shown with *ngIf while an animation is already running, the element is rendered twice: bildschirmfoto 2018-09-27 um 12 31 37 The pink and the blue box should only be shown once. This happens when hitting the toggle button multiple times in the following example: angular 7.0.0-beta.7

This also occurs with angular 6.1.9: angular 6.1.9

This issue seems related to https://github.com/angular/angular/issues/23302

Note: at no time there exists more than one component instance, see this example: https://stackblitz.com/edit/angular-gitter-dp3cub bildschirmfoto 2018-09-27 um 12 58 12

What is the motivation / use case for changing the behavior?

It’s a bug

Environment


Angular version: 7.0.0-beta.7


Browser:
- [x] Chrome (desktop) version 68
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [x] Firefox version 62
- [x] Safari (desktop) version 12
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
simeylacommented, Feb 24, 2019

I don’t know what severity1: confusing means? Perhaps that means hard to duplicate.

Here’s how :

I modified the tabs lazy loading demo on stackblitz.

The only thing I changed was adding a div element like this to each tab template.

<ng-template matTabContent>
      <div>
         Content 2 - Loaded: {{getTimeLoaded(2) | date:'medium'}}
      </div>
 </ng-template> 

You must have a device with a touch screen - or use a phone. You likely won’t be able to click fast enough with a mouse or trackpad.

Then touch as fast as you can :

  • Tab 1
  • Tab 2
  • Tab 3
  • Tab 1
  • Tab 2
  • Tab 3
  • Repeat a few times…

You’ll see this for tab 2. Notably only the middle tab is affected, so that should aid in troubleshooting.

image

The user experience will vary depending upon your tabs content. If you have an absolutely positioned tab you may not notice, but with a flex layout it’s a disaster. Also I get this bug on my iPhone with my app during normal usage - so you don’t have to go completely nuts with clicking!

@matsko would love to see progress on this now I found an easy repro.

1reaction
BeejeeDScommented, Aug 19, 2020

Having the same issue even when using [@.disabled]. The only solution is remove the animation.

Could this be related to my other issue #35825.

Animations in angular is realy a hot mess because of these bugs. It’s like the developers don’t even care about it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modal component renders Twice on open - Stack Overflow
I checked and it is rendered twice because of animation in a Modal component when an animation is finished, modal is rendered second...
Read more >
Fixing After Effects and Media Encoder Rendering Bugs and ...
This is a video on avoiding the bugs when rendering with Adobe After Effects and Adobe Media Encoder. Adobe Media encoder has a...
Read more >
Solving the React 18 Double Render problem on useEffect
First render animations and many packages have broke being unprepared for this change. useEffect with the empty dependency array is doubl ...
Read more >
React Components rendered twice — any way to fix this?
Many developer have implemented a similar functional component and have seen this behavior. Some have even opened a bug report in the official...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Web Animations. Added support for passing an optional timeline to Element.animate() (r290655); Changed setting the composite property on a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found