mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-1745: Merge session storage deep copy fix.
This commit is contained in:
@@ -70,11 +70,22 @@ angular.module('storage').factory('sessionStorageFactory', ['$injector', functio
|
|||||||
if (typeof template === 'function')
|
if (typeof template === 'function')
|
||||||
getter = template;
|
getter = template;
|
||||||
|
|
||||||
// Otherwise, always create a deep copy
|
// Otherwise, create and maintain a deep copy (automatically cached to
|
||||||
else
|
// avoid "infdig" errors)
|
||||||
getter = function getCopy() {
|
else {
|
||||||
return angular.copy(template);
|
var cached = angular.copy(template);
|
||||||
|
getter = function getIndependentCopy() {
|
||||||
|
|
||||||
|
// Reset to template only if changed externally, such that
|
||||||
|
// session storage values can be safely used in scope watches
|
||||||
|
// even if not logged in
|
||||||
|
if (!_.isEqual(cached, template))
|
||||||
|
cached = angular.copy(template);
|
||||||
|
|
||||||
|
return cached;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current value of this storage, or undefined if not yet set.
|
* The current value of this storage, or undefined if not yet set.
|
||||||
|
Reference in New Issue
Block a user