Skip to content

Commit

Permalink
fix(repeat): ensure matcher extraction once
Browse files Browse the repository at this point in the history
  • Loading branch information
bigopon committed Sep 6, 2020
1 parent 9795be6 commit 0812425
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/repeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
import {viewsRequireLifecycle} from './analyze-view-factory';
import {AbstractRepeater} from './abstract-repeater';

const matcherExtractionMarker = '__marker_extracted__';

/**
* Binding to iterate over iterable objects (Array, Map and Number) to genereate a template for each iteration.
*/
Expand Down Expand Up @@ -135,7 +137,11 @@ export class Repeat extends AbstractRepeater {
*/
bind(bindingContext, overrideContext) {
this.scope = { bindingContext, overrideContext };
this.matcherBinding = this._captureAndRemoveMatcherBinding();
const instruction = this.instruction;
if (!(matcherExtractionMarker in instruction)) {
instruction[matcherExtractionMarker] = this._captureAndRemoveMatcherBinding();
}
this.matcherBinding = instruction[matcherExtractionMarker];
this.itemsChanged();
}

Expand Down

0 comments on commit 0812425

Please sign in to comment.