Skip to content

Commit

Permalink
Fixing broken promise resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
VijayaKanchamreddy committed Oct 12, 2023
1 parent 20f2580 commit bad2022
Showing 1 changed file with 21 additions and 18 deletions.
39 changes: 21 additions & 18 deletions desktop/core/src/desktop/js/ko/components/ko.contextSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,26 +264,29 @@ HueContextSelector.prototype.setMatchingNamespace = function (compute) {
const self = this;
if (self[TYPES_INDEX.namespace.name]) {
// Select the first corresponding namespace when a compute is selected (unless selected)
self[TYPES_INDEX.namespace.lastPromise].done(() => {
if (
!self[TYPES_INDEX.namespace.name]() ||
self[TYPES_INDEX.namespace.name]().id !== compute.namespace
) {
const found = self[TYPES_INDEX.namespace.available]().some(namespace => {
if (compute.namespace === namespace.id) {
self[TYPES_INDEX.namespace.name](namespace);
setInLocalStorage('contextSelector.' + TYPES_INDEX.namespace.localStorageId, namespace);
return true;
}
});
try {
self[TYPES_INDEX.namespace.lastPromise].done(() => {
if (
!self[TYPES_INDEX.namespace.name]() ||
self[TYPES_INDEX.namespace.name]().id !== compute.namespace
) {
const found = self[TYPES_INDEX.namespace.available]().some(namespace => {
if (compute.namespace === namespace.id) {
self[TYPES_INDEX.namespace.name](namespace);
setInLocalStorage('contextSelector.' + TYPES_INDEX.namespace.localStorageId, namespace);

Check failure on line 276 in desktop/core/src/desktop/js/ko/components/ko.contextSelector.js

View workflow job for this annotation

GitHub Actions / build

Replace `'contextSelector.'·+·TYPES_INDEX.namespace.localStorageId,·namespace` with `⏎················'contextSelector.'·+·TYPES_INDEX.namespace.localStorageId,⏎················namespace⏎··············`
return true;
}
});

if (!found) {
// This can happen when a compute refers to a namespace that isn't returned by the namespaces call
// TODO: What should we do?
self[TYPES_INDEX.namespace.name](undefined);
if (!found) {
// This can happen when a compute refers to a namespace that isn't returned by the namespaces call
// TODO: What should we do?
self[TYPES_INDEX.namespace.name](undefined);
}
}
}
});
});
} catch (e) { }

Check failure on line 288 in desktop/core/src/desktop/js/ko/components/ko.contextSelector.js

View workflow job for this annotation

GitHub Actions / build

Replace `·}⏎` with `}`

}
};

Expand Down

0 comments on commit bad2022

Please sign in to comment.