fix(plugin-sequence): fix update pattern index (#1266)

This commit is contained in:
Junyi 2022-12-19 12:05:11 +08:00 committed by GitHub
parent 627a8b264b
commit a14a65596e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -261,8 +261,13 @@ export class SequenceField extends Field {
const matched = this.match(instance.get(name)); const matched = this.match(instance.get(name));
if (matched) { if (matched) {
await matched.slice(1) await matched.slice(1)
.map((_, i) => sequencePatterns.get(patterns[i].type).update).filter(Boolean) .map((_, i) => sequencePatterns.get(patterns[i].type).update)
.reduce((promise, update, i) => promise.then(() => update!.call(this, instance, matched[i + 1], patterns[i].options, options)), Promise.resolve()); .reduce((promise, update, i) => promise.then(() => {
if (!update) {
return;
}
update.call(this, instance, matched[i + 1], patterns[i].options, options)
}), Promise.resolve());
} }
} }