Skip to content

Commit

Permalink
Avoid resolving objrefs on serialization
Browse files Browse the repository at this point in the history
* Serializing a Player game object will result in certain DCs being resolved and staying in the GS cache indefinitely. This is caused by the lodash function `isFunction` which resolves the proxy, and is fixed by checking if the value is an ORP beforehand.
  • Loading branch information
Whizy committed Jul 15, 2018
1 parent 56f4a2d commit 91b2579
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/model/GameObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ GameObject.prototype.serialize = function serialize() {
var k = keys[i];
if (k[0] !== '!') {
var val = this[k];
if (!_.isFunction(val)) {
if ((val && val.__isORP) || !_.isFunction(val)) {
ret[k] = val;
}
}
Expand Down

0 comments on commit 91b2579

Please sign in to comment.