Fix infinite onChange loop in metadata
This commit is contained in:
parent
0636714829
commit
a0598bf377
@ -99,6 +99,7 @@ define(['json.sortify'], function (Sortify) {
|
|||||||
var addAuthor = function () {
|
var addAuthor = function () {
|
||||||
if (!meta.user || !meta.user.netfluxId || !priv || !priv.edPublic) { return; }
|
if (!meta.user || !meta.user.netfluxId || !priv || !priv.edPublic) { return; }
|
||||||
var authors = metadataObj.authors || {};
|
var authors = metadataObj.authors || {};
|
||||||
|
var old = Sortify(authors);
|
||||||
if (!authors[priv.edPublic]) {
|
if (!authors[priv.edPublic]) {
|
||||||
authors[priv.edPublic] = {
|
authors[priv.edPublic] = {
|
||||||
nId: [meta.user.netfluxId],
|
nId: [meta.user.netfluxId],
|
||||||
@ -110,9 +111,11 @@ define(['json.sortify'], function (Sortify) {
|
|||||||
authors[priv.edPublic].nId.push(meta.user.netfluxId);
|
authors[priv.edPublic].nId.push(meta.user.netfluxId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (Sortify(authors) !== old) {
|
||||||
metadataObj.authors = authors;
|
metadataObj.authors = authors;
|
||||||
metadataLazyObj.authors = JSON.parse(JSON.stringify(authors));
|
metadataLazyObj.authors = JSON.parse(JSON.stringify(authors));
|
||||||
change();
|
change();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var netfluxId;
|
var netfluxId;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user