fix(tab-select): Mark for check when number of tabs change #1408
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I discussed this super briefly with @emoralesb05 over email today.
When a
td-tab-option
is added to atd-tab-select
component, the new tabs are sometimes not rendered.I don't think the error is on my side - I have reproduced it in a simple repo on Stackblitz, that shows a very simple example of adding tabs programmatically can trigger this behavior. This example works well with
mat-tab-group
as well.Unfortunately, I haven't found a good way to write a failing test for this bug since change detection works differently while testing. If you have an idea for a good test, please let me know and I'll add it!
My current understanding is that since the component is using
OnPush
, change detection doesn't work when changes happen inside theContentChildren
observable. Either way, the fix is straightforward and seems to work. Unless you add/remove tabs like crazy, I don't think that it should trigger many extra change detections so the performance impact should be minimal.