perf(ivy): read selected index only when need in prop bindings (#32212)
PR Close #32212
This commit is contained in:
		
							parent
							
								
									10629600c5
								
							
						
					
					
						commit
						53f33c1cec
					
				| @ -5,7 +5,6 @@ | ||||
|  * Use of this source code is governed by an MIT-style license that can be | ||||
|  * found in the LICENSE file at https://angular.io/license
 | ||||
|  */ | ||||
| import {assertNotEqual} from '../../util/assert'; | ||||
| import {bindingUpdated} from '../bindings'; | ||||
| import {SanitizerFn} from '../interfaces/sanitization'; | ||||
| import {BINDING_INDEX, LView} from '../interfaces/view'; | ||||
| @ -35,12 +34,10 @@ import {TsickleIssue1009, elementPropertyInternal, storeBindingMetadata} from '. | ||||
|  */ | ||||
| export function ɵɵproperty<T>( | ||||
|     propName: string, value: T, sanitizer?: SanitizerFn | null): TsickleIssue1009 { | ||||
|   const index = getSelectedIndex(); | ||||
|   ngDevMode && assertNotEqual(index, -1, 'selected index cannot be -1'); | ||||
|   const lView = getLView(); | ||||
|   const bindReconciledValue = bind(lView, value); | ||||
|   if (bindReconciledValue !== NO_CHANGE) { | ||||
|     elementPropertyInternal(index, propName, bindReconciledValue, sanitizer); | ||||
|     elementPropertyInternal(getSelectedIndex(), propName, bindReconciledValue, sanitizer); | ||||
|   } | ||||
|   return ɵɵproperty; | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user