mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-16 18:34:26 +02:00
storage.js: Properly handle if keys are entirely removed
This commit is contained in:
parent
363486277b
commit
8937e11a09
@ -251,17 +251,20 @@
|
|||||||
* Update the map
|
* Update the map
|
||||||
*
|
*
|
||||||
* @param {object} newValue
|
* @param {object} newValue
|
||||||
* @param {object} oldValue
|
|
||||||
*/
|
*/
|
||||||
onChange: function(newValue, oldValue) {
|
onChange: function(newValue) {
|
||||||
// Check for deletions first. Uses keys() to iterate over a copy
|
// Check for deletions first. Uses keys() to iterate over a copy
|
||||||
this.keys().forEach(function (key) {
|
this.keys().forEach(function (key) {
|
||||||
if (typeof newValue[key] === 'undefined') {
|
if (newValue === null || typeof newValue[key] === 'undefined') {
|
||||||
this.data.delete(key);
|
this.data.delete(key);
|
||||||
$(window).trigger('StorageAwareMapDelete', key);
|
$(window).trigger('StorageAwareMapDelete', key);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
if (newValue === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Now check for new entries
|
// Now check for new entries
|
||||||
Object.keys(newValue).forEach(function(key) {
|
Object.keys(newValue).forEach(function(key) {
|
||||||
var known = this.data.has(key);
|
var known = this.data.has(key);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user