File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 afterRenderEffect ,
1313 booleanAttribute ,
1414 computed ,
15+ effect ,
1516 inject ,
1617 input ,
1718 model ,
@@ -170,7 +171,7 @@ export class Tree<V> {
170171 this . _popup ?. _controls ?. set ( this . _pattern as ComboboxTreePattern < V > ) ;
171172 }
172173
173- afterRenderEffect ( ( ) => {
174+ effect ( ( ) => {
174175 if ( typeof ngDevMode === 'undefined' || ngDevMode ) {
175176 const violations = this . _pattern . validate ( ) ;
176177 for ( const violation of violations ) {
@@ -182,16 +183,18 @@ export class Tree<V> {
182183 // Resets default focus based on selection state until interacted.
183184 afterRenderEffect ( { write : ( ) => this . _pattern . setDefaultStateEffect ( ) } ) ;
184185
185- afterRenderEffect ( ( ) => {
186- const items = inputs . items ( ) ;
187- const activeItem = untracked ( ( ) => inputs . activeItem ( ) ) ;
186+ afterRenderEffect ( {
187+ write : ( ) => {
188+ const items = inputs . items ( ) ;
189+ const activeItem = untracked ( ( ) => inputs . activeItem ( ) ) ;
188190
189- if ( ! items . some ( i => i === activeItem ) && activeItem ) {
190- this . _pattern . treeBehavior . unfocus ( ) ;
191- }
191+ if ( ! items . some ( i => i === activeItem ) && activeItem ) {
192+ this . _pattern . treeBehavior . unfocus ( ) ;
193+ }
194+ } ,
192195 } ) ;
193196
194- afterRenderEffect ( ( ) => {
197+ effect ( ( ) => {
195198 if ( ! ( this . _pattern instanceof ComboboxTreePattern ) ) return ;
196199
197200 const items = inputs . items ( ) ;
You can’t perform that action at this time.
0 commit comments