<p dir="auto"><strong>I'm submitting a ...</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[x ] bug report =&gt; search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question"><pre class="notranslate"><code class="notranslate">[x ] bug report =&gt; search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request =&gt; Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
</code></pre></div>
<p dir="auto"><strong>Current behavior</strong><br>
The global error handler logs and detects error only once. After that all other errors do not get logged to the console.</p>
<p dir="auto"><strong>Expected behavior</strong><br>
Every error get's logged to the console regardless of whether a error was thrown before or not.</p>
<p dir="auto"><strong>Minimal reproduction of the problem with instructions</strong></p>
<ol dir="auto">
<li>Go to <a href="https://plnkr.co/edit/EPXTqlN0hvJGavNPVfm7?p=preview" rel="nofollow">https://plnkr.co/edit/EPXTqlN0hvJGavNPVfm7?p=preview</a></li>
<li>Open console</li>
<li>Click a button</li>
<li>Click a second time on a button</li>
</ol>
<ul dir="auto">
<li>
<p dir="auto"><strong>Angular version:</strong> 2.4.9</p>
</li>
<li>
<p dir="auto"><strong>Browser:</strong> [all]</p>
</li>
</ul>

<ul dir="auto">
<li><strong>Language:</strong> [TypeScript 2.X]</li>
</ul>
<p dir="auto">Hi!</p>
<p dir="auto">I was wondering how Angular 2 was handling duplicates with <code class="notranslate">ngFor</code> and it's default <code class="notranslate">trackBy</code> and I was surprised to not have any warning or error.</p>
<p dir="auto">As you can see on this plunker: <a href="https://embed.plnkr.co/dv5BIa/" rel="nofollow">https://embed.plnkr.co/dv5BIa/</a></p>
<p dir="auto">If you remove the first <code class="notranslate">Foo</code> element (component 0), Angular will keep the <code class="notranslate">Guido</code> pointing on component 1 but it will reuse component 0 for the next <code class="notranslate">Foo</code>.</p>
<p dir="auto">Actually what it does is to use an identity track by but when it meets duplicates, it says nothing and does an implicit track by index on them.</p>
<p dir="auto">Well, we could say that in most cases if you get the same input, you get the same result so we don't care but suppose the component has some internal state like in the plunker (the input's state).</p>
<p dir="auto">This can be really disappointing.</p>
<p dir="auto">Is it possible to still keep this implementation but at least log a warning when we get this error?</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/teropa/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/teropa">@teropa</a> Are you the one taking care of ngFor documentation? Maybe you should present this behaviour when the trackBy section will be added to the documentation if it's not already there and I couldn't find it.</p>
<p dir="auto">Thank you guys!</p>