Skip to content

Commit

Permalink
fix(resource-select): reactivity was lost passing a ko obseravable to…
Browse files Browse the repository at this point in the history
… select2
  • Loading branch information
taylorn01 committed Mar 4, 2024
1 parent 24af371 commit ecc65c7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions arches/app/media/js/viewmodels/resource-instance-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ define([
return ko.unwrap(self.waitingForGraphToDownload) || ko.unwrap(params.disabled) || !!ko.unwrap(params.form?.locked);
});

this.disabled.subscribe((disabled) => {
if (self.select2ele) {
self.select2ele.prop("disabled", disabled);
}
});

// this is a hack to get the dropdown to clear properly
// for some reason setting self.resourceToAdd("") didn't work
self.select2ele = null;
Expand Down Expand Up @@ -507,6 +513,8 @@ define([
},
initSelection: function(ele, callback) {
self.select2ele = ele;
self.select2ele.prop("disabled", self.disabled());

if(!self.displayOntologyTable && !!self.value() && !self.graphIds().includes(self.value())) {
var values = self.value();
if(!Array.isArray(self.value())){
Expand Down

0 comments on commit ecc65c7

Please sign in to comment.