Skip to content

Commit 1e7067e

Browse files
author
Jessica Shi
committed
fix cache bug
1 parent 5e732b3 commit 1e7067e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

javascripts/demo.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,11 @@ function demo() {
234234
if (order > 0) {
235235
var listId = "dims" + t;
236236
var formatNameId = "format" + t;
237-
var formatName = tblFormatsView.namesCache.hasOwnProperty(t) ?
238-
tblFormatsView.namesCache[t] : "Dense array";
237+
var namesList = tblFormatsView.getFormatNamesList(order);
238+
239+
var nameCached = (cached && tblFormatsView.namesCache.hasOwnProperty(t) &&
240+
namesList.concat(["Custom"]).includes(tblFormatsView.namesCache[t]));
241+
var formatName = nameCached ? tblFormatsView.namesCache[t] : "Dense array";
239242

240243
listTensorsBody += "<tr>";
241244
listTensorsBody += "<td class=\"mdl-data-table__cell--non-numeric\" ";
@@ -265,7 +268,7 @@ function demo() {
265268
listTensorsBody += formatNameId;
266269
listTensorsBody += "\">";
267270

268-
for (var name of tblFormatsView.getFormatNamesList(order)) {
271+
for (var name of namesList) {
269272
listTensorsBody += "<li><a id=\"";
270273
listTensorsBody += formatNameId + "_" + name + "\" >";
271274
listTensorsBody += name + "</a></li>";
@@ -380,6 +383,7 @@ function demo() {
380383

381384
for (t in model.input.tensorOrders) {
382385
if (model.input.tensorOrders[t] > 0) {
386+
tblFormatsView.insertNamesCacheEntry(t, $("#format" + t).val());
383387
tblFormatsView.insertLevelsCacheEntry(t,
384388
tblFormatsView.createEntryFromId("dims" + t));
385389
}

0 commit comments

Comments
 (0)