Make metadata-manager a bit more robust

pull/1/head
Caleb James DeLisle 7 years ago
parent 342b6012f7
commit 90d00c10b1

@ -51,9 +51,9 @@ define(['json.sortify'], function (Sortify) {
mdo[meta.user.netfluxId] = meta.user;
}
metadataObj.users = mdo;
var lazyUserStr = JSON.stringify(metadataLazyObj.users[meta.user.netfluxId]);
var lazyUserStr = Sortify(metadataLazyObj.users[meta.user.netfluxId]);
dirty = false;
if (lazy || lazyUserStr !== JSON.stringify(meta.user)) {
if (lazy || lazyUserStr !== Sortify(meta.user)) {
metadataLazyObj = JSON.parse(JSON.stringify(metadataObj));
lazyChangeHandlers.forEach(function (f) { f(); });
}
@ -105,6 +105,7 @@ define(['json.sortify'], function (Sortify) {
updateMetadata: function (m) {
// JSON.parse(JSON.stringify()) reorders the json, so we have to use sortify even
// if it's on our own computer
if (!m) { return; }
if (Sortify(metadataLazyObj) === Sortify(m)) { return; }
metadataObj = JSON.parse(JSON.stringify(m));
metadataLazyObj = JSON.parse(JSON.stringify(m));

Loading…
Cancel
Save