Skip to content

Commit 385bf10

Browse files
author
Vlad Balin
committed
assignFrom assigns change token from the source
1 parent e7a4291 commit 385bf10

File tree

7 files changed

+26
-7
lines changed

7 files changed

+26
-7
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/transactions.js

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/transactions.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/transactions.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,16 @@ export abstract class Transactional implements Messenger, IONode, Validatable, T
180180

181181
// Assign transactional object "by value", copying aggregated items.
182182
assignFrom( source : Transactional | Object ) : this {
183-
return this.set( ( <any>source ).__inner_state__ || source, { merge : true } );
183+
this.set( ( <any>source ).__inner_state__ || source, { merge : true } );
184+
185+
// Synchronize change tokens
186+
const { _changeToken } = source as any;
187+
188+
if( _changeToken ){
189+
this._changeToken = _changeToken;
190+
}
191+
192+
return this;
184193
}
185194

186195
// Apply bulk object update without any notifications, and return open transaction.

tests/typescript/dist/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,12 @@ var Transactional = (function () {
10321032
return this;
10331033
};
10341034
Transactional.prototype.assignFrom = function (source) {
1035-
return this.set(source.__inner_state__ || source, { merge: true });
1035+
this.set(source.__inner_state__ || source, { merge: true });
1036+
var _changeToken = source._changeToken;
1037+
if (_changeToken) {
1038+
this._changeToken = _changeToken;
1039+
}
1040+
return this;
10361041
};
10371042
Transactional.prototype.parse = function (data, options) { return data; };
10381043
Transactional.prototype.deepGet = function (reference) {

tests/typescript/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)