fix(ivy): reset binding index before executing a template in refreshView
call (#32201)
Prior to this change, the `BINDING_INDEX` of a given lView was reset after processing a template. However change detection can be triggered as a result of View queries processing, thus leading to subsequent `refreshView` call (and executing a template), which in turn operates with the binding index that is not reset after the previous `refreshView` call. This commit updates the logic to reset binding index before we execute a template, so binding index is correct for instructions inside template function. PR Close #32201
This commit is contained in:
@ -377,14 +377,14 @@ export function refreshView<T>(
|
||||
try {
|
||||
resetPreOrderHookFlags(lView);
|
||||
|
||||
if (templateFn !== null) {
|
||||
executeTemplate(lView, templateFn, RenderFlags.Update, context);
|
||||
}
|
||||
|
||||
// Resetting the bindingIndex of the current LView as the next steps may trigger change
|
||||
// detection.
|
||||
lView[BINDING_INDEX] = tView.bindingStartIndex;
|
||||
|
||||
if (templateFn !== null) {
|
||||
executeTemplate(lView, templateFn, RenderFlags.Update, context);
|
||||
}
|
||||
|
||||
const checkNoChangesMode = getCheckNoChangesMode();
|
||||
const hooksInitPhaseCompleted =
|
||||
(flags & LViewFlags.InitPhaseStateMask) === InitPhaseState.InitPhaseCompleted;
|
||||
|
Reference in New Issue
Block a user