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.

[Tabs] Tabs are loaded eagerly

See original GitHub issue

Bug, feature request, or proposal:

Bug or possibly poor design

What is the expected behavior?

When a tab is never opened, its contents should never be added to the DOM. This is how things worked with alpha 9 on Angular 2.0.1

What is the current behavior?

Even if a tab is never opened, its content is added to the DOM before being removed.

What are the steps to reproduce?

This plunk shows the old behavior , from alpha 9. If you run the application while looking at network requests for images, you will see that only the image from the first tab is downloaded. To download another image, you need to open its tab.

This plunk shows the new behavior, from alpha 10. In this case, all images are downloaded immediately, then removed from the DOM.

What is the use-case or motivation for changing an existing behavior?

In my use case, I have a menu on the first tab and a video on each of several other tabs. Since I upgraded to alpha 10, the browser fetches all the videos at once instead of waiting for the user to open a tab. This results in excessive bandwidth usage.

The same problem would occur for an app that has different image galleries organized by tab

Which versions of Angular, Material, OS, browsers are affected?

Angular 2.1.2, Material 2 alpha 10 on Firefox 49

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:22 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
amcdnlcommented, Aug 15, 2017

@benelliott - We are working with the core team to fix this behavior. Stay tuned for updates 😃

3reactions
pantoniscommented, Nov 14, 2017

@andrewseguin What is the expected behavior of this when it is fixed? Only active tab content is added to DOM? Or all tabs content are added?

Read more comments on GitHub >

github_iconTop Results From Across the Web

how can angular6 eager load tab content - Stack Overflow
By default, the tab contents are eagerly loaded. Eagerly loaded tabs will initalize the child components but not inject them into the DOM...
Read more >
Implement Lazy Loading with Mat Tabs in Angular - Medium
Lazy loading the modules using Mat Tabs. Angular Material tabs organize content into separate views where only one view can be visible at...
Read more >
Angular material tabs with lazy loaded routes - Zoaib Khan
Let's create a scalable, tabbed UI with Angular Material tabs and lazy load the tab contents with routes - making your apps load...
Read more >
Tabs - Angular Material
By default, the tab contents are eagerly loaded. Eagerly loaded tabs will initialize the child components but not inject them into the DOM...
Read more >
Intelligent lazy loading of tabs when Chrome launches with ...
Just the new tab page only, with a message that says the following: Tabs in a QuickChrome window will be discarded once the...
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