Skip to content

Commit

Permalink
improve kv source
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Shan committed Feb 1, 2024
1 parent 511bdc6 commit 38a085c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/datasource/KeyValueDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ export abstract class KeyValueDataSource extends DataSource {
}
if (changed.length === 0) return;
if (ignoreMissingKey) {
// 由于newValues允许只提供部分值,这里进行一次浅拷贝合并
newValues = Object.assign(Object.assign({}, this.values), newValues);
} else {
for (const key of this.monitorKeys) {
if (!newValues.hasOwnProperty(key)) {
newValues[key] = undefined;
}
}
}
return {
type: DataContentType.KV,
oldValue: this.values,
// 由于newValues允许只提供部分值,这里进行一次浅拷贝合并
newValue: newValues,
changedKeys: changed,
};
Expand Down

0 comments on commit 38a085c

Please sign in to comment.