bug(CdkPortalOutlet): Component can be rendered outside CdkPortalOutlet
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 91
説明
### Is this a regression?
- [ ] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
_No response_
### Description
If you have ComponentPortal with provided ViewContainerRef NgForOf can rerender component outside CdkPortalOutlet.
Looks like [this code](https://github.com/angular/components/blob/7a24e95bafbdeb697f74a48e275c2442bcbefc74/src/cdk/portal/portal-directives.ts#L166) is executed only once and after NgForOf dom manipulations there is nothing that can move ComponentPortalExample to expected position
### Reproduction
[Demo](https://stackblitz.com/edit/angular-ivy-lthq8f?file=src%2Fapp%2Fportal.component.ts,src%2Fapp%2Fapp.module.ts,src%2Fapp%2Fapp.component.html)
Steps to reproduce:
1. Wait until component outlet will render component
2. Drag Item 1 down
3. Drag Item 1 up
4. ComponentPortalExample is rendered inside item list instead of inside component outlet
instead
### Expected Behavior
ComponentPortalExample should stay inside CdkPortalOutlet
### Actual Behavior
ComponentPortalExample is rendered inside item list instead of inside CdkPortalOutlet
### Environment

コントリビューションガイド
調査の方向性
リンク先のコードの src/cdk/portal/portal-directives.ts から始め、提供されている StackBlitz デモを使って問題を再現します。ComponentPortal、提供されている ViewContainerRef、NgForOf による DOM の並べ替えの相互作用を調査します。Item 1 を下にドラッグしてから上に戻した後も ComponentPortalExample が CdkPortalOutlet 内に残れば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- frontend
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100