Skip to content

Commit aad42c9

Browse files
committed
getSelectedPricingUnit cache
1 parent b7a61ce commit aad42c9

File tree

1 file changed

+14
-0
lines changed
  • services/static-webserver/client/source/class/osparc/store

1 file changed

+14
-0
lines changed

services/static-webserver/client/source/class/osparc/store/Study.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ qx.Class.define("osparc.store.Study", {
2020

2121
statics: {
2222
__nodeResources: null,
23+
__nodePricingUnit: null,
2324

2425
patchStudyData: function(studyData, fieldKey, value) {
2526
if (osparc.data.model.Study.OwnPatch.includes(fieldKey)) {
@@ -200,6 +201,19 @@ qx.Class.define("osparc.store.Study", {
200201
},
201202

202203
getSelectedPricingUnit: function(studyId, nodeId) {
204+
// init nodePricingUnit if it is null
205+
if (this.__nodePricingUnit === null) {
206+
this.__nodePricingUnit = {};
207+
}
208+
209+
// check if the pricing unit for this node is already fetched
210+
if (
211+
studyId in this.__nodePricingUnit &&
212+
nodeId in this.__nodePricingUnit[studyId]
213+
) {
214+
return Promise.resolve(this.__nodePricingUnit[studyId][nodeId]);
215+
}
216+
203217
const params = {
204218
url: {
205219
studyId,

0 commit comments

Comments
 (0)